executing script even when we close connection via ssh
Hi all,
I need to run a shell script on e remote machine, my connection is now strong, or I want to shut down my machine. But problem is when I close my connection(or lost it), execution of script is terminated. I googled a lot, I saw using of nohup or screen, but none of them worked for me. I really need to do that. Any help is appreciated a lot. |
What did you try?
nohup: Code:
nohup ./script > script.out 2>&1 & Code:
$ screen -S thisismyscreen bash |
Thanks a lot for your answer, but is this after I ssh to remote machine?
Could you please explain it more? and here it is what I am doing:(which does not work at all) Code:
ssh root@remoteserver screen -d -m ./script |
Better use nohup instead of screen cmd. (See manual here)
Code:
~$ nohup ./script.sh > /path/to/output |
Thanks a lot, it simply worked.
|
Both of my examples are intended to be run after you log in and are sitting at an interactive command prompt on the remote server. Once you run them, you can then log out of SSH and close the terminal without the background process aborting.
|
All times are GMT -5. The time now is 08:17 PM. |