Created
September 25, 2018 14:13
-
-
Save pamolloy/f72ca82f413719464260072eb46c5828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start-stop-daemon -K -n "/root/foo" | |
no /root/foo found; none killed | |
# /root/grep-cmdline.bash | |
/root/foo | |
# ps aux | grep foo | |
1534 root bash /root/foo | |
2864 root grep foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for cl in /proc/*/cmdline; do | |
cat $cl | grep foo | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
NAME=foo | |
DAEMON=/root/$NAME | |
case "$1" in | |
start) | |
printf "Starting $NAME: " | |
start-stop-daemon -S -q -b -x $DAEMON | |
[ $? = 0 ] && echo "OK" || echo "FAIL" | |
;; | |
stop) | |
set -x | |
printf "Stopping $NAME: " | |
start-stop-daemon -K -q -n $NAME | |
[ $? = 0 ] && echo "OK" || echo "FAIL" | |
set +x | |
;; | |
restart|reload) | |
echo "Restarting $NAME: " | |
$0 stop | |
sleep 1 | |
$0 start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment