snapcast/openWrt/snapserver.init
2016-10-15 11:18:15 +02:00

43 lines
793 B
Bash
Executable file

#!/bin/sh /etc/rc.common
# Author: Johannes Pohl <johannes.pohl@badaix.de>
START=90
SERVICE_NAME=snapserver
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
SERVICE_PID_FILE=/var/run/$SERVICE_NAME/pid
DESC="Snapcast server"
DAEMON=/usr/bin/$SERVICE_NAME
SNAPSERVER_OPTS="-d"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$SERVICE_NAME ] && . /etc/default/$SERVICE_NAME
if [ "$START_SNAPSERVER" != "true" ] ; then
exit 0
fi
#
# Function that starts the daemon/service
#
start()
{
service_start $DAEMON $SNAPSERVER_OPTS
}
#
# Function that stops the daemon/service
#
stop()
{
service_stop $DAEMON
killall $DAEMON
# Many daemons don't delete their pidfiles when they exit.
rm -f $SERVICE_PID_FILE
}