#!/bin/sh prefix=/usr/local exec_prefix=${prefix} # Checking if the fwplugd daemon is running. pid=`ps ax | awk '{if (match($5, ".*/fwplugd$") || $5 == "fwplugd") print $1}'` # See how we were called. case "$1" in start) if test "$pid" = ""; then ${exec_prefix}/bin/fwplugd if test $? != 0; then echo "fwplugd: unable to start daemon." exit 1 fi else echo "fwplugd: already running." exit 1 fi echo "fwplugd: started daemon." ;; stop) if test "$pid" != ""; then kill $pid else echo "fwplugd: not running." exit 1 fi echo "fwplugd: stopped daemon." ;; restart) $0 stop sleep 1 $0 start ;; status) if test "$pid" = ""; then echo "fwplugd: not running." else echo "fwplugd: running." fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit $?