+

Last commit for wifidog-gateway.init: ec0175a343756638049846b92562e3cf1049c6ca

Redirect all wifidog output in a logfile

Benjamin Renard [2013-08-14 10:56:46]
Redirect all wifidog output in a logfile
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: wifidog-gateway
  4. # Required-Start: $local_fs $remote_fs $network $syslog $named
  5. # Required-Stop: $local_fs $remote_fs $network $syslog $named
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # X-Interactive: true
  9. # Short-Description: Start/stop wifidog gateway daemon
  10. ### END INIT INFO
  11.  
  12. DAEMON_BIN=/usr/bin/wifidog
  13. WDCTL_BIN=/usr/bin/wdctl
  14. DAEMON_DEFS=/etc/default/wifidog-gateway
  15. DAEMON_CONF=/etc/wifidog.conf
  16. LOG_FILE=/var/log/wifidog
  17. LOG_LEVEL=6
  18. OPTIONS=""
  19. NAME=wifidog-gateway
  20. DESC="Wifidog Gateway"
  21.  
  22. [ -x "$DAEMON_BIN" ] || exit 0
  23. [ -s "$DAEMON_DEFS" ] && . $DAEMON_DEFS
  24. [ ! -r "$DAEMON_CONF" ] && echo "Configuration file $DAEMON_CONF not present or unreadable" && exit 0
  25. [ "$WIFIDOG_ENABLED" != "yes" ] && echo "$NAME disabled. see /etc/default/wifidog-gateway." && exit 0
  26.  
  27. DAEMON_OPTS="-c $DAEMON_CONF -s -d $LOG_LEVEL"
  28.  
  29. . /lib/lsb/init-functions
  30.  
  31. case "$1" in
  32. start)
  33. log_daemon_msg "Starting $DESC" "$NAME"
  34. start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_BIN" -- $DAEMON_OPTS > $LOG_FILE 2>&1
  35. log_end_msg "$?"
  36. ;;
  37. stop)
  38. log_daemon_msg "Stopping $DESC" "$NAME"
  39. start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_BIN" > $LOG_FILE 2>&1
  40. log_end_msg "$?"
  41. ;;
  42. restart|reload|force-reload)
  43. $0 stop
  44. sleep 2
  45. $0 start
  46. ;;
  47. status)
  48. $WDCTL_BIN status
  49. exit $?
  50. ;;
  51. *)
  52. N=/etc/init.d/$NAME
  53. echo "Usage: $N {start|stop|restart|force-reload|reload|status}" >&2
  54. exit 1
  55. ;;
  56. esac
  57.  
  58. exit 0