ssh command to execute shell script in another server


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ssh command to execute shell script in another server
# 1  
Old 01-12-2012
ssh command to execute shell script in another server

Code:
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
Code:
ssh -q <anotherserver> /opt/tcs/satish/tst.ksh > log &

can someone let me know what is the error ???????

how to execute a shell script which is located in another server.


Moderator's Comments:
Mod Comment Use code tags please, thank you. Check your PMs.

Last edited by zaxxon; 01-12-2012 at 02:38 PM.. Reason: code tags, check PM
# 2  
Old 01-12-2012
The error probably means what it says -- it can't find nohup.

Does that server actually have nohup on it?

If it does, is it in the PATH of the script being run?
# 3  
Old 01-12-2012
this is the path of the script to be run

/opt/tcs/satish/tst.ksh

-----------------------
nohup is present in that server, when i logging from that server and executed that script,,,, script is doing well

is my syntax correct ?
# 4  
Old 01-12-2012
Quote:
Originally Posted by only4satish
this is the path of the script to be run

/opt/tcs/satish/tst.ksh
I said PATH, not path. PATH as in the special variable PATH, which the shell uses to hunt for programs.

Where is nohup on that server?

What value does the script have for PATH? 'echo $PATH' if unsure.
# 5  
Old 01-12-2012
i donno where is nohup in another server ???

can u please change the script/syntax if any ?
Code:
ssh -q <anotherserver> /opt/tcs/satish/tst.ksh > log &


Last edited by vbe; 01-16-2012 at 01:29 PM.. Reason: code tags
# 6  
Old 01-12-2012
Quote:
Originally Posted by only4satish
i donno where is nohup in another server ???
If you don't know where nohup is on the remote server, how do you know it's there at all?

Run whereis nohup on the remote server to see if it can find it.
Quote:
can u please change the script/syntax if any ?
I don't have magic solutions that'll work no matter what the problem is. I can give you things to look at to help you figure out which problem it is.
 
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 ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

3. Shell Programming and Scripting

Execute command using ssh server 'cmd'

Hi The command below does not work as it require to take command in the breakers But If I do so the variable values get lost ssh testserver01 'dsmc q b "${ARCHIVE_DIR}*" -sub=yes -querysummary -inactive -fromd="${BACKUP_DATE}"' Thank you. (3 Replies)
Discussion started by: zam
3 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 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

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

7. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

8. Shell Programming and Scripting

bash script to execute a command remote servers using ssh

Hello, I am running into few issues, please suggest me what I am missing. I am running this script on a linux host. Main idea of this script is to, login to each host via ssh and get uid of user, service user that I trying to run this script, has already deployed ssh keys and provide sudo... (8 Replies)
Discussion started by: bobby320
8 Replies

9. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: orablue
1 Replies

10. 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
Login or Register to Ask a Question