How to execute a script using ssh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ksn2007
    New Member
    • Jan 2008
    • 13

    How to execute a script using ssh

    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
  • prn
    Recognized Expert Contributor
    • Apr 2007
    • 254

    #2
    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":
    Code:
    #! /bin/sh
    perl myscript.pl &
    exit
    You can call it with
    Code:
    ssh user@host startmyscript.sh
    Then ssh can disconnect and exit.

    HTH,
    Paul

    Comment

    • ksn2007
      New Member
      • Jan 2008
      • 13

      #3
      Thanks paul,It is working.....sor ry for the late reply as I didnot come to office for the last two days
      Thanks&Regards
      KSN

      Comment

      Working...