| | |
executing a script remotely
![]() |
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
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
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!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
![]() |
Similar Threads
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
- -_-_- Featured Online Portal For Sale -_-_- (Websites for Sale)
Other Threads in the Shell Scripting Forum
- Previous Thread: SSH that requires a password via a bash script
- Next Thread: Script to prompt Linux user for hostname and unique NFS share
| Thread Tools | Search this Thread |






