I am a noob to shell scripting, I tried searching but could not find a solution.
I have a bad internet connection and it keeps dropping. I have to run certain commands on a remote server. When I ssh on a terminal and run those commands and the connection drops, I’m not sure if the command continues or it also stops (I assume that it would behave as if a Ctrl^C has been received. Am I correct?)
Now i’ve put all the commands inside a shell script. ftp-ed it on the server and am running it on a terminal via ssh. Will this guarantee that my commands would run even if the connection gets dropped. Or should I wrap it inside another shell script?
Thank you.
If you need to preserve the command that is run remotely after the connection drops use
nohup. For details seeman nohup. I guess all you need to do is to run on remote side:More precisely, whenever the connection is dropped, on the server side timeout occurs, the socket is closed and with it all the processes that belong to the process tree of the ssh connection process.