import cinit from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
parent
3729fc68eb
commit
423ba10303
13396 changed files with 269468 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# wait for daemon to terminate
|
||||
# the pidfile is our first argument,
|
||||
# the dameon the second and all others are for the daemon
|
||||
# 2005-06-12 (Last Changed: 2005-06-17)
|
||||
|
||||
# how long to sleep before rechecking
|
||||
SLEEP=5
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "`basename $0` <pidfile> <daemon> [daemon arguments]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PIDFILE=$1; shift
|
||||
DAEMON=$1; shift
|
||||
|
||||
# remove old pidfile
|
||||
[ -e "$PIDFILE" ] && rm -f $PIDFILE
|
||||
|
||||
$DAEMON $@
|
||||
|
||||
PID=$(cat "$PIDFILE")
|
||||
|
||||
ISALIVE=$(ps ax | awk '{ print $1 }' | grep "^$PID\$")
|
||||
|
||||
while [ "$ISALIVE" ]; do
|
||||
sleep ${SLEEP}
|
||||
ISALIVE=$(ps ax | awk '{ print $1 }' | grep "^$PID\$")
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue