init.j2 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /bin/sh
  2. #
  3. ### BEGIN INIT INFO
  4. # Provides: scanbuttond
  5. # Required-Start: $syslog $local_fs $remote_fs
  6. # Required-Stop: $syslog $local_fs $remote_fs
  7. # Should-Start: dbus avahi
  8. # Should-Stop: dbus avahi
  9. # Default-Start: 2 3 4 5
  10. # Default-Stop: 0 1 6
  11. # Short-Description: Wifi-with-me form
  12. # Description: Get good will from people :)
  13. #
  14. ### END INIT INFO
  15. # Alternative init script using foreground option (do not work otherwise
  16. # with epson perfection 1660)
  17. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  18. INSTALL_DIR={{ wwm_install_dir }}
  19. DAEMON=${INSTALL_DIR}/backend.py
  20. NAME=wifi-with-me
  21. DESC="Wifi with me, formulaire wifi"
  22. test -x $DAEMON || exit 0
  23. RUN_AS_USER={{ wwm_user }}
  24. set -e
  25. case "$1" in
  26. start)
  27. echo -n "Starting $DESC: "
  28. start-stop-daemon -d $INSTALL_DIR -b --start --quiet \
  29. --chuid $RUN_AS_USER --exec $DAEMON -- $DAEMON_OPTS
  30. echo "$NAME."
  31. ;;
  32. stop)
  33. echo -n "Stopping $DESC: "
  34. start-stop-daemon --stop --oknodo --quiet \
  35. --exec $DAEMON
  36. echo "$NAME."
  37. ;;
  38. force-reload)
  39. # check whether $DAEMON is running. If so, restart
  40. start-stop-daemon --stop --test --quiet \
  41. --exec $DAEMON -- $DAEMON_OPTS \
  42. && $0 restart \
  43. || exit 0
  44. ;;
  45. restart)
  46. echo -n "Restarting $DESC: "
  47. start-stop-daemon --stop --oknodo --quiet \
  48. --exec $DAEMON
  49. sleep 1
  50. start-stop-daemon -d $INSTALL_DIR -b --start --quiet \
  51. --chuid $RUN_AS_USER --exec $DAEMON -- $DAEMON_OPTS
  52. echo "$NAME."
  53. ;;
  54. *)
  55. N=/etc/init.d/$NAME
  56. echo "Usage: $N {start|stop|restart|force-reload}" >&2
  57. exit 1
  58. ;;
  59. esac
  60. exit 0