snapcast/openWrt/snapclient.init
2016-04-06 23:00:08 +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=snapclient
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
SERVICE_PID_FILE=/var/run/$SERVICE_NAME.pid
DESC="Snapcast client"
DAEMON=/usr/bin/$SERVICE_NAME
SNAPCLIENT_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_SNAPCLIENT" != "true" ] ; then
exit 0
fi
#
# Function that starts the daemon/service
#
start()
{
service_start $DAEMON $SNAPCLIENT_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
}