How to Run a Linux Command That Still Runs After I Close My Putty Ssh Session

How to maintain command after exiting SSH?

Found out the issue was with cPanel, as it did not support node.js. I moved to DigitalOcean and it worked fantastically there.

Automatically close PuTTY when connection is lost

PuTTY is not intended for automation.

Use PLink (PuTTY command-line tool). It's a console application, with the same command line arguments as PuTTY, so the transition should be easy.


Though setting "Close window on exit" to "Always" does work (even if you claim it does not).

Does quitting putty close the running command

Assuming your goal is to have the rsync command continue to run, the simplest thing is to orphan the job. There are two ways to do this:

(rsync foo bar &)

The above will create the job detached from your terminal in the beginning, so closing the terminal will not stop it.

rsync foo bar & # or without &, then Ctrl-Z to stop, then "bg" to background
disown

The above will disown a running job, so you can close the terminal without stopping it.

Finally, you could use the program screen(1) or similar to keep a terminal session alive and intact (and able to be resumed) even when you end your Putty session.

Getting ssh to execute a command in the background on target machine

I had this problem in a program I wrote a year ago -- turns out the answer is rather complicated. You'll need to use nohup as well as output redirection, as explained in the wikipedia artcle on nohup, copied here for your convenience.

Nohuping backgrounded jobs is for
example useful when logged in via SSH,
since backgrounded jobs can cause the
shell to hang on logout due to a race
condition [2]. This problem can also
be overcome by redirecting all three
I/O streams:

nohup myprogram > foo.out 2> foo.err < /dev/null &


Related Topics



Leave a reply



Submit