Keeping a process running on server even SSH is closed
22,282
Solution 1
Two different ways:
- Use
nohup
- by starting the program withnohup /path/to/program &
, nohup keep the program running and any output will be redirected to the filenohup.out
in the current directory - Use
screen
ortmux
if either of them is installed on the server. They are a way to keep one or more shells going so that you can re-attach to them the next time you login - it's a much more powerful utility than nohup.man screen
orman tmux
for more information.
Solution 2
Here's how to keep a process running that you've already started without using nohup.
Suppose you started decompressing a large archive and now you want to go home.
$ tar -xzf bigfile.tar.gz
Press ctrl-z to send the processs to the background. You can type "jobs" and press enter and see the job number for your process, probably it's 1.
Then do:
$ disown %1
Solution 3
Either screen or tmux will both work.
See for instance http://www.jeffstory.org/wordpress/?p=132 for a quick tutorial on how to use it.
Author by
user68537
Updated on September 18, 2022Comments
-
user68537 over 1 year
I am running long program on server, which is basically Jar file of java program. I want to keep this program running even if SSH terminal is closed, how I can keep this program running on server?