By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,712 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,712 IT Pros & Developers. It's quick & easy.

How to execute a script using ssh

P: 13
Hi All,
I have a perl script which runs forever.I want to run it from another machine with ssh. The command i gave is
ssh user@host perl myscript.perl
The command is ok for the scripts which have little execution time.But the problem is,the command i gave is waiting for the completion of execution of the script(ssh not exiting as the process is running).I want the command to just start the execution of the script and come out.
Please help me in this.
Thanks,
KSN
Jan 18 '08 #1
Share this Question
Share on Google+
2 Replies

prn
Expert 100+
P: 254
prn
I have a somewhat comparable situation. The obvious solution (to me) was to create a script on the "host" machine that just fired off the main script as a detached process. For example, a script "startmyscript.sh":
Expand|Select|Wrap|Line Numbers
  1. #! /bin/sh
  2. perl myscript.pl &
  3. exit
You can call it with
Expand|Select|Wrap|Line Numbers
  1. ssh user@host startmyscript.sh
Then ssh can disconnect and exit.

HTH,
Paul
Jan 18 '08 #2

P: 13
Thanks paul,It is working.....sorry for the late reply as I didnot come to office for the last two days
Thanks&Regards
KSN
Jan 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.