fip-current/init_script
Yann Weber bcafd50a3d From Python to shell script
- Allowing to run mpd + icecast2 + fip relay with metadatas on a VM
  with 128Mo of memory.
- Calculating when to update (given the end field in the JSON)
2019-01-08 02:26:50 +01:00

60 lines
1.2 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="PATH TO SCRIPT"
DAEMON="${DPATH}/fip_current.sh"
NAME="fip-current"
DESC="fip-current update script"
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
log_end_msg $?
fi
;;
stop)
log_daemon_msg "Stopping $DESC"
start-stop-daemon --stop -p $PIDFILE --remove-pidfile
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