#!/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


# 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
SNAPCLIENT_OPTS="-d $SNAPCLIENT_OPTS"

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 $SERVICE_NAME
	# Many daemons don't delete their pidfiles when they exit.
	rm -f $SERVICE_PID_FILE
}

