Keep running a script via ssh
5,878
Solution 1
Use "nohup" to run a command immune to hangups, with output to a non-tty:
nohup your_command &
and to run a command via ssh, without first logging into the remote machine:
ssh user_name@machine_address "nohup your_script.sh" &
Solution 2
ssh user@server "nohup script.sh >/var/log/output.log 2>&1 &"
That should run the remote command without leaving a running ssh process on your client.
Solution 3
$ ssh [email protected] screen -dm long-script.sh
Related videos on Youtube
Comments
-
Arturo Herrero over 1 year
ssh
can use to run remote commands.ssh [email protected] 'long-script.sh'
I run a long script that will take a lot of time, but I want to close my computer and keep running the script in the remote server. I know how to achieve this with GNU Screen, but I need do it via
ssh
.Can I do that without interrupting my script?
-
choroba over 12 yearsWhat's wrong with starting screen on the remote server?
-