Restart the script after re-connecting.
Linux screen solves this problem with providing a terminal that runs on server and just exported to your putty/Terminal client. In simple terms, you are running your putty on remote machine and watching the output on your local client.
Now, if you client goes down, just chill!
Screen is running your script on remote machine.
To start a screen session:
- Login to remote machine with as you may wish.
- Run $screen
- Do you stuff
Power cut and, no net connection and your client is down.
Once power is back, just re-login to remote machine.
It'll list all screen sessions running on the remote machine. Get attached to one of the session with: