SSH remote command execute stays without disconnect when finished execute?

9,391

Try redirecting stdin, stdout, and stderr to /dev/null. For an explanation, see https://serverfault.com/questions/36419/using-ssh-to-remotely-start-a-process.

Share:
9,391

Related videos on Youtube

user1289947
Author by

user1289947

Updated on September 18, 2022

Comments

  • user1289947
    user1289947 over 1 year

    I am trying to build a script/command that will restart our Asterisk/Elastix service on our PBX. The script is basically using simple command with auto log-in public key that run from Ubuntu 14.04LTS:

    The command script is:

    ssh user@iphost 'service asterisk restart'
    

    But after the command finished and service restarted, the ssh stays and only after ctrlc its breaks out.

    My question, is how can I terminate the session after the command completes?

  • user1289947
    user1289947 almost 10 years
    Hi i had "TERM environment variable not set" thanks any idea
  • user1289947
    user1289947 almost 10 years
    didn't worked :-(
  • Louis Matthijssen
    Louis Matthijssen almost 10 years
    Are you sure? The first one should always work. Can you post the output of the command?