1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!/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 liquidsoap channels: "
cd $rundir
has_channels=
for liq in *.pid ; do
if test $liq != '*.pid' ; then
has_channels=1
echo -n "$liq "
start-stop-daemon --stop --quiet --pidfile $liq --retry 4
fi
done
if test -n "$has_channels"; then
echo "OK"
else
echo "no script found in $confdir"
fi
;;
start)
echo -n "Starting liquidsoap channels: "
cd $confdir
has_channels=
for liq in *.liq ; do
if test $liq != '*.liq' ; then
has_channels=1
echo -n "$liq "
start-stop-daemon --start --quiet --pidfile $rundir/${liq%.liq}.pid \
--chuid $user:$group --exec $liquidsoap -- -d $confdir/$liq
fi
done
if test -n "$has_channels"; then
echo "OK"
else
echo "no script found in $confdir"
fi
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}"
exit 1
;;
esac
|