Linux / UNIX Tech Support Forum
This is a discussion on bash script to collect info within the Shell scripting forums, part of the Development/Scripting category; hi i need script that will ssh to some Linux red hat via ssh and collect configuration file (rpm list ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
hi i need script that will ssh to some Linux red hat via ssh and collect configuration file (rpm list and /etc/hosts etc..)
I read about the ssh and there is some problem to save the password in the script for this moment i don't care about that, thanks moshik |
| Sponsored Links | ||
|
|
|
||||
|
That's quite easy to achieve (with pubkeys so you don't have to enter passwords everytime). Run Remote Commands with SSH should get you started. However, there are much better tools for monitoring multiple boxes out there. Zabbix, Munin, Monit and Nagios are just the ones coming to mind right now.
__________________
teh.geekosphere.org |
|
|||
|
thanks for the quick response,but i can't use those program only with bash script,
so. if you can supply some script that will collect information from Linux and then will move the information to other Linux via (scp, or rsync or sftp) |
|
||||
|
Simple sample script:
Code:
#!/bin/bash OUT=report.out.txt >$OUT echo "Hostname : $(hostname)" >> $OUT echo "Date : $(date)" >> $OUT echo "Memory info: " >> $OUT free -m >>$OUT echo "Disk info: " >> $OUT df -h >>$OUT scp $OUT you@somewhere.com # mail -s "Sys Info" you@somewherelese.com < $OUT
__________________
Vivek | My personal blog Linux Evangelist + ADD [SOLVED] thread prefix to your thread when your problem is sorted out by editing your thread. + Always use CODE tags for posting system output and commands! |
|
|||
|
thanks
now i need to move some file to folder i use this : #!/bin/bash OUT="$(hostname)" mkdir "$(hostname)" `cp /etc/hosts` >> OUT #free -m >>$OUT #echo "Disk info: " >> $OUT #df -h >>$OUT #scp $OUT you@somewhere.com and it not move please assist |
|
||||
|
To copy files to folder
Code:
cp /path/to/file /path/to/folder
__________________
Vivek | My personal blog Linux Evangelist + ADD [SOLVED] thread prefix to your thread when your problem is sorted out by editing your thread. + Always use CODE tags for posting system output and commands! |
|
|||
|
thanks,
how i can set in the script telnet session telnet to ip address password run command and execute to file/folder and i want to make cp to file's from some folders to backup folder in one line cp /path/to/file and /path/to/file and path/to/file and then move to /path/to/folder BR, moshik |
|
||||
|
Don't use telnet, it is insecure protocol. Use openssh server and open ssh client.
First set ssh keys, see my howto: SSH Public key based authentication - Howto Once done that, run ssh command as follows Code:
ssh you@server-name.com command1 ssh you@server-name.com cp /path/to/something /here/dest
__________________
Vivek | My personal blog Linux Evangelist + ADD [SOLVED] thread prefix to your thread when your problem is sorted out by editing your thread. + Always use CODE tags for posting system output and commands! |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| howto get my cpu info on linux system? | chiku | Linux software | 4 | 05-20-2008 08:06 PM |
| Does Redhat have "what" utility which can be used to display identification Info? | DCAO | Linux software | 2 | 10-30-2007 07:23 PM |
| Require Shell Script Which sends all server info on mail | puppen | Linux software | 3 | 10-25-2006 08:07 PM |
| USER INFO | asim.mcp | Linux software | 1 | 08-09-2006 03:18 AM |
| find out info. reg. files for each user in the system | ganes | Solaris/OpenSolaris | 6 | 09-20-2005 06:49 PM |