Visit Our UNIX and Linux User Community


help needed. run shell scipt remotely


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help needed. run shell scipt remotely
# 1  
Old 08-18-2009
Data help needed. run shell scipt remotely

Dear all ,

I have a script. this script called get.sh and can get some solaris infomation and save the result as result.tar.gz.

the problem is : we have 12 servers. every time. I need to login 12 server and do the same job 12 times.Smilie


master server
|
- - - - - - - - - - - - - - - - -
| | | |
slave1 slave2 slave3 slave n

my idea:
1. choose one server as master server, I just need to upload the get.sh to this server.
2. define slave server's ip, account in master server ,and save these infomation as account.cfg
3. master server can copy the get.sh to slave server
4.master server run the script in slave server.
5. master server get all infomation result.tar.gz and ftp to master server.

My question is about step 4.

How can I write a script to execute get.sh on slave server.

master ------------------------------->>> slave
another server needed? get.sh
# 2  
Old 08-18-2009
if the script is in master server You can copy that to the slave server using rcp or may be ftp.

And from master server u can use rsh to execute the remote script
pls check the man pages of rsh for more details
# 3  
Old 08-18-2009
You can actually run the script from the master server this way

[#Use the case statement and run one script on the master server

#use already created ssh keys
case $1
in
client1 key=client1 ;;
client2 key=client2 ;;
clientn key=clientn ;;
esac

case $1
in
client1 USER=user1 ;;
client2 USER=user2 ;;
clientn USER=user3 ;;
esac


ssh -i ssh_key_directory/$key $USER@$1<<EF
#run whatever u want to run on the clients
cmd1
cmd2


EF]

U can search the forum on how to create ssh keys.

Previous Thread | Next Thread
Test Your Knowledge in Computers #28
Difficulty: Easy
Unix was the first fully supported 64-bit operating system for personal computers.
True or False?

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

How to run the files in Linux shell scipt?

I have a homework and I tried to work on this but unable to find the solution. Can someone help me how to resolve the issue. I have a package file and it contains text file as prod.ame300_000001.101414145111.A.txt. In the text file it contains pdf file... (1 Reply)
Discussion started by: pavand
1 Replies

2. Shell Programming and Scripting

Run yes/no script remotely

I have this script in server2 # cat /root/yesno.sh #!/bin/bash read -p "are you sure?" -n 1 -r if $ ]]; then echo "" echo "YES" else echo "NO" fi # sh /root/yesno.sh are you sure?y YES (5 Replies)
Discussion started by: anil510
5 Replies

3. Shell Programming and Scripting

Find not finding stuff if run remotely

Hello I'm working on script to find tomcat on all my servers. Then find out what version of tomcat is installed. Basically I want to check and see if the latest version is installed. I'm testing the script on Solaris 10. I'm also going to need it to work on RHEL and SLES. If I run the following... (7 Replies)
Discussion started by: bitlord
7 Replies

4. Shell Programming and Scripting

Change the font of text in output file in shell scipt

hi, I want to change the font of text in output file. :( I tried the below code code: if awk 'BEGIN{if('$RSS'>='1000')exit 0;exit 1}' then RED=`echo "\033 i can see colors in terminal but not in output file :wall: please help me how i can get colors text in output file. edit... (1 Reply)
Discussion started by: sreelu
1 Replies

5. Shell Programming and Scripting

Create a list of commands in a central location, and then run them all remotely through a ssh here

I'm trying to write a script that in the end will from one central location hop to a bunch of servers and then run a series of ping tests. The thing is, the list of devices that needs to be pinged is going to be different for each server. So what I want to do is be able to do is read through the... (0 Replies)
Discussion started by: DeCoTwc
0 Replies

6. Shell Programming and Scripting

howto run remotely call function from within script

Hi I have the following script : #!/bin/ksh #################### Function macAddressFinder ######################## macAddressFinder() { `ifconfig -a > ipInterfaces` `cat ipInterfaces` } ####################################################################### # # print... (2 Replies)
Discussion started by: presul
2 Replies

7. Shell Programming and Scripting

trigger a script based on the run status of another scipt

Im a newbee.. I have a script which runs few times daily. I want to write another script which should pick up the latest log generated from the last run of the first job and trigger a thrid script if the first script runs successfuly. Please help... Cheers (1 Reply)
Discussion started by: Athena
1 Replies

8. Shell Programming and Scripting

how to avoid space to run remotely

If I run the following command remotely after ssh than it works fine su - oracle -c "/oracle/product/102/db/bin/dbshut" But If I run the following command it doesn't work su - oracle -c "/oracle/product/102/db/bin/lsnrctl stop" Because I think there is a space is present between lsnrctl and... (1 Reply)
Discussion started by: madhusmita
1 Replies

9. UNIX for Advanced & Expert Users

find command from shell scipt (ksh) problem

Hi experts, I have a simple shell script as follows. #!/bin/ksh FIND_STRING="\( -name 'testfile*.Z' -o -name 'DUMMY_*' \) " find /tmp -type f $FIND_STRING -print When I run this with ksh -x testscript, I get the following output. + FIND_STRING=\( -name 'testfile*.Z' -o -name... (6 Replies)
Discussion started by: kodermanna
6 Replies

10. UNIX for Dummies Questions & Answers

Exit from telnet when run Remotely

ssh user@host -q -n 'grep `hostname` /etc/hosts; telnet 10.100.23.45 1234;' When i run this command remotely it is hanging and not giving me the prompt, Can anyone tell me how can I exit a telnet command remotely please. Thanks. (10 Replies)
Discussion started by: venu_nbk
10 Replies

Featured Tech Videos