Monday, October 17, 2016

nohup Execute Commands After You Exit From a Shell Prompt

http://www.cyberciti.biz/tips/nohup-execute-commands-after-you-exit-from-a-shell-prompt.html


nohup [command_name] &

Example
nohup find / -xdev -type f -perm +u=s -print > out.txt &



Kill all processes that contain a string in name:
https://stackoverflow.com/questions/8987037/how-to-kill-all-processes-with-a-given-partial-name

check first:  pgrep -fa my_pattern

then:            pkill -f my_pattern


http://stackoverflow.com/questions/16809134/how-to-get-a-list-of-programs-running-with-nohup


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 &
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
  • TTY column = the terminal associated with the process
  • STAT column = state of a process
    • S = interruptible sleep (waiting for an event to complete)
    • l = is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
Reference

$ man ps # then search /PROCESS STATE CODES

1 comment:

  1. http://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and

    ReplyDelete