Work -l after nohup

How can I track a job that is still working (I think it's disconnected?) After I started it with nohup, logged out of the server and logged in? I usually use jobs -l to see what works, but it shows an empty one.

+4
source share
4 answers

You need to understand the difference between a process and a task . Tasks are managed by the shell, so when you end a terminal session and start a new one, you are now in a new instance of Bash with your own task table. You cannot access tasks from the original shell, but as other answers noted, you can still find and manage running processes. For instance:

 $ nohup sleep 60 & [1] 27767 # Our job is in the jobs table $ jobs [1]+ Running nohup sleep 60 & # And this is the process we started $ ps -p 27767 PID TTY TIME CMD 27767 pts/1 00:00:00 sleep $ exit # and start a new session # Now jobs returns nothing because the jobs table is empty $ jobs # But our process is still alive and kicking... $ ps -p 27767 PID TTY TIME CMD 27767 pts/1 00:00:00 sleep # Until we decide to kill it $ kill 27767 # Now the process is gone $ ps -p 27767 PID TTY TIME CMD 
+5
source

You can track if processes, if they are still running, using

ps -p <pid> , where is the process ID that you get after using the nohup command.

If you see that the valid records you are processing are probably alive.

+2
source

You can have a list of processes running under the current user using ps -u "$USER" or ps -u "$(whoami)" .

+2
source

Try the following:

 ps -ef | grep <pid> 
+1
source

Source: https://habr.com/ru/post/1496895/


All Articles