How to Execute shell in more than one server?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to Execute shell in more than one server?
# 1  
Old 01-27-2014
How to Execute shell in more than one server?

Hi ,

I got a shell in one physical server and want to execute it in different servers. I did tried using ssh but iam not successful. Can someone through somelight on the subject and with some working examples ?

Also iam trying PHP in the front end to execute the shell and show the logs in the UI.
Not sure if this can be achieved through PHP as well.

FYI. Iam working on solaris boxes and got only readonly access to other servers.

Appreciate any help on it.

Regards,
Sukumar
# 2  
Old 01-27-2014
Please show us what you have tried.
# 3  
Old 01-28-2014
Options tried

Hi,

Please find the below options which I have tried.

Code:
bsits001z$ ssh readonly@12.16.24.25  'exec bash' '/opt/tibco/logs/bw/EAI_Automation/test_automation.sh 447830748554'
Could not create directory '/home/readonly/.ssh'.
The authenticity of host '12.16.24.25 (12.16.24.25)' can't be established.
RSA key fingerprint is 4e:1d:f4:05:bb:d0:28:97:c3:1e:c9:32:0d:b9:1f:28.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/readonly/.ssh/known_hosts).
Password:
Could not chdir to home directory /home/readonly: No such file or directory
bash: /opt/tibco/logs/bw/EAI_Automation/test_automation.sh: No such file or directory
bsits001z$
bsits001z$ ssh readonly@12.16.24.25  'exec bash' < /opt/tibco/logs/bw/EAI_Automation/test_automation.sh 447830748554
Could not create directory '/home/readonly/.ssh'.
The authenticity of host '12.16.24.25 (12.16.24.25)' can't be established.
RSA key fingerprint is 4e:1d:f4:05:bb:d0:28:97:c3:1e:c9:32:0d:b9:1f:28.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/readonly/.ssh/known_hosts).
Password:
Could not chdir to home directory /home/readonly: No such file or directory
bash: 447830748554: No such file or directory

# 4  
Old 01-29-2014
Help requried !!

Hi All,

Appreciate your help.

regards,
cskumar.
# 5  
Old 01-29-2014
Does /opt/tibco/logs/bw/EAI_Automation/test_automation.sh exist on the remote computer or the local one?
# 6  
Old 01-29-2014
If it's on the local computer, you'll need to feed it into ssh. You can tell bash '-s' as in 'read from standard input and assume the following text are arguments', to pass in 447830748554 as $1.

Code:
ssh readonly@12.16.24.25  'exec bash -s 447830748554' < /opt/tibco/logs/bw/EAI_Automation/test_automation.sh

# 7  
Old 01-29-2014
Thanks

Smilie Thanks..It worked perfectly
This User Gave Thanks to cskumar For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to execute setDomainEnv.sh in wblogic via ssh on remote server in shell script?

How to execute setDomainEnv.sh in wblogic via ssh on remote server in shell script we execute setDomainEnv.sh manually as . ./setDomainEnv.sh from its location ie /opt/SP/users/domian/bin" My approach is not working. Please advise. #!/bin/bash set -x base="/opt/SP/users/d1/bin"... (5 Replies)
Discussion started by: abhaydas
5 Replies

2. Shell Programming and Scripting

Execute a shell script in UNIX server from Cygwin

Hi All, We have shell scripts in UNIX ( Sun OS ) server. Also in my windows machine i have Cygwin installed. Now is there a way to execute Shell script available in UNIX server from Cygwin? (4 Replies)
Discussion started by: Girish19
4 Replies

3. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

4. Shell Programming and Scripting

How to execute a shell script that resides in another server?

hi, i have a shellscipt that is in another server, my question is how do i run the script from a different server. EXAMPLE: SCRIPT_NAME: sample.sh SERVER: A what i wanted to achieve is to call that script from server B. Tried using ssh ssh <username>@serverB /home/sample.sh but... (5 Replies)
Discussion started by: reignangel2003
5 Replies

5. Shell Programming and Scripting

Shell script to copy a file from one server to anther server and execute the binary

Hi , Is there any script to copy a files (weblogic bianary + silent.xml ) from one server (linux) to another servers and then execute the copy file. We want to copy a file on multiple servers and run the installation. Thanks (1 Reply)
Discussion started by: Nawrajesh
1 Replies

6. Shell Programming and Scripting

i want to execute shell script on remote server with in sftp session

Hi, I want to execute shell script with in sftp session for remote server. like i have a shell script test.sh that is on local server.i want to execute that script on remote server sftp user@192.168.56.10 sftp> test.sh ---execute for remote server not for local server. sftp... (3 Replies)
Discussion started by: SAUD PASHA
3 Replies

7. UNIX for Dummies Questions & Answers

ssh command to execute shell script in another server

ssh -q <hostname> /opt/tcs/satish/tst.ksh ssh -q <anotherserver> /opt/tcs/satish/tst.ksh tst.ksh has "nohup <command> & " when i execute below script , its throwing error as nohup can not be found ssh -q <anotherserver> /opt/tcs/satish/tst.ksh > log & can someone let me... (5 Replies)
Discussion started by: only4satish
5 Replies

8. Shell Programming and Scripting

how to execute shell script in another server that contain sql.

hi all, how to execute shell script in another server that contain sql script. i tried using "ssh -l" option.. but i am unable to load the environment variable of the remote host. please suggest how execute the shell script contain sql part inside it. (2 Replies)
Discussion started by: sandeep909
2 Replies

9. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

10. UNIX for Advanced & Expert Users

execute a script on test server from dev server

I need to execute a script from dev server which is located on Test server.I can use ftp to connect to dev server and from there how can i execute a command on test server. Thanks (5 Replies)
Discussion started by: ukatru
5 Replies
Login or Register to Ask a Question