Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/

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.

share|improve this question
Have you already considered using putty as terminal and screen on the linux machine? – ott-- Apr 25 '12 at 11:28
up vote 1 down vote accepted

I'm a fan of,

plink.exe username@myserver "echo /home/username/ | 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.

share|improve this answer

If you use nohup in your command line, the script will continue running even though the session ends. So, changing your command to something like

plink.exe username@myserver nohup /home/username/

Should do it.

share|improve this answer
I prefer this one as it lets me do the command as fast as it can. good for fast shutdowns like echo y | plink.exe -i key leeroy@server1 "nohup /home/leeroy/ > /dev/null" This is handy for when your main UPS is being serviced/broken and you are using a small one instead and need to save precious seconds during an outage. The echo y is so plink will blindly accept the ssh key if required. – BeowulfNode42 Nov 19 '15 at 5:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.