linuxshellcentosnohup

How to get a list of programs running with nohup


I am accessing a server running CentOS (linux distribution) with an SSH connection. Since I can't always stay logged in, I use "nohup [command] &" to run my programs.

I couldn't find how to get a list of all the programs I started using nohup. "jobs" only works out before I log out. After that, if I log back again, the jobs command shows me nothing, but I can see in my log files that my programs are still running.

Is there a way to get a list of all the programs that I started using "nohup" ?


Solution

  • When I started with $ nohup storm dev-zookeper ,

    METHOD1 : using jobs,

    prayagupd@prayagupd:/home/vmfest# jobs -l
    [1]+ 11129 Running                 nohup ~/bin/storm/bin/storm dev-zookeeper &
    

    NOTE: jobs shows nohup processes only on the same terminal session where nohup was started. If you close the terminal session or try on new session it won't show the nohup processes. Prefer METHOD2

    METHOD2 : using ps command.

    $ ps xw
    PID  TTY      STAT   TIME COMMAND
    1031 tty1     Ss+    0:00 /sbin/getty -8 38400 tty1
    10582 ?        S      0:01 [kworker/0:0]
    10826 ?        Sl     0:18 java -server -Dstorm.options= -Dstorm.home=/root/bin/storm -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dsto
    10853 ?        Ss     0:00 sshd: vmfest [priv] 
    

    TTY column with ? => nohup running programs.

    Description

    Reference

    $ man ps # then search /PROCESS STATE CODES