56 lines
725 B
Plaintext
56 lines
725 B
Plaintext
|
#!/bin/sh
|
||
|
#
|
||
|
# Start cfm
|
||
|
#
|
||
|
|
||
|
DAEMON="cfm_server"
|
||
|
|
||
|
PIDFILE="/var/run/$DAEMON.pid"
|
||
|
|
||
|
# shellcheck source=/dev/null
|
||
|
[ -r "/etc/default/cfm_server" ] && . "/etc/default/cfm_server"
|
||
|
|
||
|
start() {
|
||
|
printf "Starting cfm daemon: "
|
||
|
start-stop-daemon -S -b -q -m -p $PIDFILE \
|
||
|
-x /usr/bin/$DAEMON
|
||
|
status=$?
|
||
|
if [ "$status" -eq 0 ]; then
|
||
|
echo "OK"
|
||
|
else
|
||
|
echo "FAIL"
|
||
|
fi
|
||
|
return $status
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
printf "Stopping cfm daemon: "
|
||
|
start-stop-daemon -K -q -p $PIDFILE
|
||
|
status=$?
|
||
|
if [ "$status" -eq 0 ]; then
|
||
|
rm -f "$PIDFILE"
|
||
|
echo "OK"
|
||
|
else
|
||
|
echo "FAIL"
|
||
|
fi
|
||
|
return $status
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
start
|
||
|
;;
|
||
|
stop)
|
||
|
stop
|
||
|
;;
|
||
|
restart|reload)
|
||
|
stop
|
||
|
start
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage: $0 {start|stop|restart}"
|
||
|
exit 1
|
||
|
esac
|
||
|
|
||
|
exit $?
|