#!/bin/sh
### BEGIN INIT INFO
# Provides:          retrodebian-fluxbox-watch-menu
# Required-Start:    $local_fs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Watch and filter Fluxbox generated menu
### END INIT INFO

DAEMON=/opt/retrodebian/fluxbox/watch-menu.sh
PIDFILE=/var/run/retrodebian-fluxbox-watch-menu.pid

case "$1" in
  start)
    echo "Starting retrodebian-fluxbox-watch-menu"
    start-stop-daemon --start --background --make-pidfile --pidfile "$PIDFILE" --exec "$DAEMON"
    ;;
  stop)
    echo "Stopping retrodebian-fluxbox-watch-menu"
    start-stop-daemon --stop --pidfile "$PIDFILE" --retry 5
    rm -f "$PIDFILE"
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    ;;
esac

exit 0