Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Created February 23, 2011 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterkeen/840678 to your computer and use it in GitHub Desktop.
Save peterkeen/840678 to your computer and use it in GitHub Desktop.
transcript
$ cat run
cat run
#!/bin/sh
nohup bash -c 'while true; do sleep 10; done' </dev/null &> sleeper.log &
echo $! > /tmp/sleeper.pid
;
$ sudo ./run
sudo ./run
[sudo] password for pak:
$ cat /tmp/sleeper.pid
cat /tmp/sleeper.pid
27167
$ ps auxwww | grep 27167
ps auxwww | grep 27167
root 27167 0.0 0.0 63828 1052 pts/5 S 08:36 0:00 bash -c while true; do sleep 10; done
pak 27237 0.0 0.0 61148 728 pts/5 S+ 08:36 0:00 grep 27167
$ kill -0 27167
kill -0 27167
bash: kill: (27167) - Operation not permitted
$ echo $!
echo $!
31020
$ kill -0 27167
kill -0 27167
bash: kill: (27167) - Operation not permitted
$ echo $?
echo $?
1
$ perl58 -e 'print kill(0, 27167)'
perl58 -e 'print kill(0, 27167)'
0
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment