4 # description: codemux startup script
9 . /etc/rc.d/init.d/functions
13 pidfile=/var/run/$PROC.pid
16 pid=`cat $pidfile 2>/dev/null`
18 # this eliminates a race condition between checking existence of pidfile
19 # and reading its value
21 [ -n "$pid" -a -d /proc/$pid ]
26 echo -n "starting $PROC:"
27 pid=`cat $pidfile 2>/dev/null`
28 if [ -n "$pid" ]; then
29 # check whether process really exists
30 # yes - don't try to start
31 [ -d /proc/$pid ] && action "already running" /bin/true && exit 1
33 # no - PID file is stale
37 initlog -c /usr/sbin/codemux
40 check_status && touch /var/lock/subsys/$PROC || cmd=failure
46 echo -n "shutting down $PROC: "
51 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROC
61 check_status && echo 'running' && exit 0 || \
62 echo 'not running' && exit 1
66 echo "Usage: $0 {start|stop|restart|status}"