executing a script remotely

Reply

Join Date: Nov 2008
Posts: 2
Reputation: curto21 is an unknown quantity at this point 
Solved Threads: 0
curto21 curto21 is offline Offline
Newbie Poster

executing a script remotely

 
0
  #1
Nov 19th, 2008
I need help trying to execute a script remotely using ssh.

I'm writing a script that will run on a local machine. From that script I need to execute a script on a remote machine. The problem is that when I run the remote script using ssh, it's output is shown as if it were running locally. I need the script to run commands on the remote machine, not the local one. This is what I am doing:

ssh root@remoteServer /var/spool/asterisk/voicemail/default/script

That remote script needs to execute commands on files relative to its location on the remote machine. Maybe ssh isn't the best method to invoke this. Any help would be appreciated.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 2
Reputation: curto21 is an unknown quantity at this point 
Solved Threads: 0
curto21 curto21 is offline Offline
Newbie Poster

Re: executing a script remotely

 
0
  #2
Nov 19th, 2008
by the way... this is being done in a bash script. Thanks!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: executing a script remotely

 
0
  #3
Nov 20th, 2008
Hey there,

Interesting. your execution statement looks like it should work. You can hedge your bets by enclosing the remote command in quotes:

sh root@remoteServer "/var/spool/asterisk/voicemail/default/script"

also, to double verify, add the hostname command in there:

ssh root@remoteServer "hostname;/var/spool/asterisk/voicemail/default/script;hostname"

You should the remote host name, your output and the remote hostname again. If that works, just strip the hostname commands back out.

I'd be interested if this doesn't work. If possible, in the unfortunate event that you still experience your issue, could you send output from:

ssh -v -v -v root@remoteServer /var/spool/asterisk/voicemail/default/script

that'll give us insane debug output

Best wishes,

Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: executing a script remotely

 
0
  #4
Nov 20th, 2008
Are you sure that it isnt working it will run the script but pull any output back to the server you are working on. Put a large sleep in the script then log on to the server that your running the script on remotely to check whether it is exeucting or not!
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 1,756
Reputation: DimaYasny will become famous soon enough DimaYasny will become famous soon enough 
Solved Threads: 85
Featured Poster
DimaYasny DimaYasny is offline Offline
Posting Virtuoso

Re: executing a script remotely

 
0
  #5
Nov 20th, 2008
just redirect the output to the remote system log file
Real stupidity always beats Artificial Intelligence. (Terry Pratchett)

BA BizMg, MCSE, DCSE, Linux+, Network+
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC