64 lines
1.3 KiB
Bash
Executable File
64 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: liquidsoap
|
|
# Required-Start: $remote_fs $network $time
|
|
# Required-Stop: $remote_fs $network $time
|
|
# Should-Start:
|
|
# Should-Stop:
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Starts the liquidsoap daemon
|
|
# Description:
|
|
### END INIT INFO
|
|
|
|
user=@install_user@
|
|
group=@install_group@
|
|
prefix=@prefix@
|
|
exec_prefix=@exec_prefix@
|
|
confdir=@sysconfdir@/liquidsoap
|
|
liquidsoap=@bindir@/liquidsoap
|
|
rundir=@localstatedir@/run/liquidsoap
|
|
|
|
# Test if $rundir exists
|
|
if [ ! -d $rundir ]; then
|
|
mkdir -p $rundir;
|
|
chown $user:$group $rundir
|
|
fi
|
|
|
|
case "$1" in
|
|
stop)
|
|
echo -n "Stopping channels: "
|
|
cd $rundir
|
|
for liq in *.pid ; do
|
|
if test $liq != '*.pid' ; then
|
|
echo -n "$liq "
|
|
start-stop-daemon --stop --quiet --pidfile $liq --retry 4
|
|
fi
|
|
done
|
|
echo "OK"
|
|
;;
|
|
|
|
start)
|
|
echo -n "Starting channels: "
|
|
cd $confdir
|
|
for liq in *.liq ; do
|
|
if test $liq != '*.liq' ; then
|
|
echo -n "$liq "
|
|
start-stop-daemon --start --quiet --pidfile $rundir/${liq%.liq}.pid \
|
|
--chuid $user:$group --exec $liquidsoap -- -d $confdir/$liq
|
|
fi
|
|
done
|
|
echo "OK"
|
|
;;
|
|
|
|
restart|force-reload)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|force-reload}"
|
|
exit 1
|
|
;;
|
|
esac
|