batadv-vis.init.j2 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: batadv-vis
  4. # Required-Start: $remote_fs $network alfred
  5. # Required-Stop: $remote_fs $network alfred
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: batadv-vis
  9. ### END INIT INFO
  10. # Author: Nils Schneider <nils@nilsschneider.net>
  11. PATH=/sbin:/bin
  12. DESC="batadv-vis"
  13. NAME=batadv-vis
  14. DAEMON=/usr/local/sbin/$NAME
  15. PIDFILE=/var/run/$NAME.pid
  16. SCRIPTNAME=/etc/init.d/$NAME
  17. GROUP=alfred
  18. OPTIONS="-s"
  19. [ -x "$DAEMON" ] || exit 0
  20. # Source defaults.
  21. [ -r /etc/default/$NAME ] && . /etc/default/$NAME
  22. [ -n "$BATMANIF" ] && OPTIONS="$OPTIONS -i $BATMANIF"
  23. . /lib/lsb/init-functions
  24. case "$1" in
  25. start)
  26. log_daemon_msg "Starting $DESC" "$NAME"
  27. start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
  28. --make-pidfile --background \
  29. --exec "$DAEMON" --oknodo -- $OPTIONS
  30. log_end_msg $?
  31. ;;
  32. stop)
  33. log_daemon_msg "Stopping $DESC" "$NAME"
  34. start-stop-daemon --stop --quiet --pidfile "$PIDFILE" \
  35. --retry 1 --oknodo
  36. log_end_msg $?
  37. ;;
  38. restart|force-reload)
  39. $0 stop
  40. sleep 1
  41. $0 start
  42. ;;
  43. status)
  44. status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
  45. ;;
  46. *)
  47. echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
  48. exit 1
  49. ;;
  50. esac
  51. exit $?