Linux – Running Linux Script from Windows in backgound

batch-filecross platformlinuxremote-accesswindows 7

I'm using following script from my windows machine to run on linux and do backup.

@ECHO off
:: run remote command
plink.exe username@myserver /home/username/do-backup.sh

Problem with this script is that, i have to keep my session live. as backup takes 30 minutes or so , so I want to know if there is any way I run this script and after that backup command keeps working even if i turn off my system. or you can say that i execute my batch file it goes to server, execute script on server and then comes back while backup script keeps running on server.

Best Answer

I'm a fan of,

plink.exe username@myserver "echo /home/username/do-backup.sh | at now + 1 min"

which will tell the remote server to start the script in 1 minutes time.

Note that because this is running the script via the scheduler, you may need to ensure the script sets up the environment correctly, it might not be exactly the same environment as when run through an interactive session.

Related Topic