How to use ssh execute other shell script on other host (shell script include nohup)?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to use ssh execute other shell script on other host (shell script include nohup)?
# 1  
Old 11-18-2010
How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following :


host01> ssh host02 autoexec.sh

autoexec.sh include nohup command like follwing :

nohup /home/jack/deletedata.sh &

after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh on the host02, pls help me ,many thanks ...
# 2  
Old 11-18-2010
I'd redirect stdout and stderr to logfiles in the autoexec.sh script eg:

Code:
nohup /home/jeck/deletedata.sh > /home/jack/deletedata.log 2>&1 &

Just in case there is some funny issue with deletedata.sh not getting the correct environment, or needing a tty, etc.
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

Shell script help to execute ssh remote commands

Hi, The below command is not giving me the count , Can somebody help me in re-writing this pls . Proc_Exist=`ssh -q -o "BatchMode=yes" -o "PasswordAuthentication=no" $OAUSER@${Primary_Node} ps -ef | grep -v grep | grep "${ICM_Proc}" |wc -l ` Also the same problem with below... (13 Replies)
Discussion started by: Y.balakrishna
13 Replies

3. Shell Programming and Scripting

Nohup inside shell script

Hi, I want to run another script inside shelll script in nohup mode. let explain. under the same folder ,I have two scripts scrone.sh scrtwo.sh In scrone.sh if then nohup ./scrtwo.sh & echo " Script two has been run correctly" else echo " Exiting from the script" fi If... (3 Replies)
Discussion started by: ckchelladurai
3 Replies

4. Shell Programming and Scripting

How to execute one shell script after execution of another shell script?

I have a master shell script master.sh which will invoke 2 shell scripts (test1.sh,test2.sh). Both of these shell scripts will execute stored procedure. I will invoke test1.sh, test2.sh respectively. Now both of these scripts are executing parallel. But i want to invoke the 2nd script(test2.sh)... (3 Replies)
Discussion started by: vel4ever
3 Replies

5. Shell Programming and Scripting

shell script not working with nohup

Hello, I am trying to run a shell script with the nohup command. The shell script takes an array of files, runs a python program on each file in a loop, and appends the output to a file. This works fine on the server, but if I try to use the nohup command it does not work. --- #!/bin/sh... (10 Replies)
Discussion started by: ricitron
10 Replies

6. 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

7. Shell Programming and Scripting

How to include a command in shell script?

# dbc "delete from alert;" DELETE 10 # However, the script created below generates an error that command does not exits. Can any one please exist. script.sh: #!/bin/sh dbc "delete from alert;" >>$TASKLOGFILE ./script.sh: line 38: dbc: command not found can any one please... (2 Replies)
Discussion started by: sureshcisco
2 Replies

8. UNIX for Dummies Questions & Answers

Include PERL script with in the unix shell script

Hi Gurus, Is it possible to include perl script with in the unix shell script? What would be the general syntax? In the above case, is it required to write the below first two lines of codes? #!usr/bin/sh -x #!usr/bin/perl -w Thanks in advance / Mysore Ganapati. (1 Reply)
Discussion started by: ganapati
1 Replies

9. UNIX for Dummies Questions & Answers

To call/execute a shell script from a shell script

Hi , I have 4 shell scripts a.ksh b.ksh -> depends on a.ksh success -> log into b.log c.ksh -> depends on b.ksh success -> log into c.log d.ksh -> depends on c.ksh success -> log into d.log I will have to write main.ksh ( execute a.ksh , log into a.log if a.ksh= success, execute... (1 Reply)
Discussion started by: konark
1 Replies

10. Programming

How to include shell script in C program

hi I want to call a shell script in C program the script is : ssh -t user@remote sh /<remote>home/user/<file_name>.sh and other several commands C program : Call this script and the retrive the task that is been done in <file_name>.sh file can any one tell me how... (5 Replies)
Discussion started by: mridula
5 Replies
Login or Register to Ask a Question