3 # An attempt at a simple, distribution-independent daemon management.
5 # Copyright (C) 2000-2001 Mission Critical Linux, Inc.
12 if [ -f /var/run/${base}.pid ]
14 pid=`head -1 /var/run/${base}.pid`
22 pid=`ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
23 { if ((prog == $5) || (("(" prog ")") == $5) ||
24 (("[" prog "]") == $5) ||
25 ((prog ":") == $5)) { print $1 ; exit 0 } }' $1`
35 # check if it is already running
37 [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && echo " already running." && return
42 $* && echo " done." || echo " failed."
52 if ps h $pid>/dev/null 2>&1
55 if ps h $pid>/dev/null 2>&1
58 if ps h $pid>/dev/null 2>&1
61 if ps h $pid>/dev/null 2>&1
69 ps h $pid >/dev/null 2>&1
71 [ $RC -eq 0 ] && echo " failed." || echo " done."
72 [ $RC -eq 0 ] || rm -f /var/run/$base.pid >/dev/null 2>&1
85 if ps h $pid >/dev/null 2>&1
87 echo "$base (pid $pid) is running."
90 if [ -f /var/run/${base}.pid ]
92 echo "$base dead but pid file exists."
95 echo "$base is stopped."
100 echo "$base is stopped."