fip-current/init_script
Yann Weber d35735cf65 Add a loop mode and an init script
- add one argument -l --loop
- add one conf key loop-delay
2016-06-05 12:29:16 +02:00

63 lines
1.3 KiB
Bash

#! /bin/sh
### BEGIN INIT INFO
# Provides: fip-current
# Required-Start: $remote_fs $network icecast2
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Icecast2 FIP relay metadata update script
# Description: Start updating Icecast2 metadatas using FIP radio wep API
### END INIT INFO
DPATH=/PUT/SCRIPT/PATH/HERE
SCRIPT="fip_current.py"
DAEMON="${DPATH}/${SCRIPT}"
CONFIG="${DPATH}/conf.ini"
NAME="fip-current"
DESC="fip-current update script"
DAEMON_OPTS="-ul -c $CONFIG"
PIDFILE="/run/fip-current.pid"
set_path()
{
echo "DPATH variable not set or wrong in init_script";
exit 1;
}
test -x $DAEMON || set_path
. /lib/lsb/init-functions
case $1 in
start)
log_daemon_msg "Starting $DESC"
if $0 status >/dev/null
then
echo -n " allready running"
log_end_msg 1
else
start-stop-daemon --quiet --start --background -m -p $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
log_end_msg $?
fi
;;
stop)
log_daemon_msg "Stopping $DESC"
start-stop-daemon --stop -p $PIDFILE --remove-pidfile -x $DAEMON
log_end_msg $?
;;
restart)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|status}" >&2
exit 1
;;
esac