PuTTY or OTHER - Keep executing command even after exiting PuTTY [duplicate]

Try

nohup Background_ScriptX &

nohup ensures that a process is not terminated when a terminal is closed. The & symbol pushes the process into the background.

Hope this was helpful.


If you want to read the output at a later date, you can use screen:

screen -d -m my_command

This gives you a detached terminal you can connect to later (screen -r) to read the stdout/stderr output.


Another option if nohup command is not available is to use the disown command.

First you can view your background tasks by running jobs in terminal. You can get the job number from there.

Now just run disown %[job number] and the process will be detached from the current terminal and stay alive when you log out.

Side note: Make sure that you are asking the correct question. If you are running actual services as you hint in your sample you might want to look into how to create a daemon in the OS of your choice. This is to make sure that the process still runs after a reboot and make it more consistent with other services.

Hope this helps.


Since screen has been mentioned: there are other terminal multiplexers out there. I like tmux very much, see e.g. this other superuser question, tmux vs screen for a comparison.