Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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