Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: trakt
  4. # Required-Start: $remote_fs $syslog $networking
  5. # Required-Stop: $remote_fs $syslog $networking
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: trakt
  9. # Description: LILiK user manager interface
  10. ### END INIT INFO
  11. DIR=/srv/trakt
  12. DAEMON=$DIR/server.py
  13. DAEMON_NAME=trakt
  14. # Add any command line options for your daemon here
  15. DAEMON_OPTS=""
  16. # This next line determines what user the script runs as.
  17. DAEMON_USER=trakt
  18. # The process ID of the script when it runs is stored here:
  19. PIDFILE=/var/run/$DAEMON_NAME.pid
  20. . /lib/lsb/init-functions
  21. do_start () {
  22. log_daemon_msg "Starting system $DAEMON_NAME daemon"
  23. start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
  24. log_end_msg $?
  25. }
  26. do_stop () {
  27. log_daemon_msg "Stopping system $DAEMON_NAME daemon"
  28. start-stop-daemon --stop --pidfile $PIDFILE --retry 10
  29. log_end_msg $?
  30. }
  31. case "$1" in
  32. start|stop)
  33. do_${1}
  34. ;;
  35. restart|reload|force-reload)
  36. do_stop
  37. do_start
  38. ;;
  39. status)
  40. status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
  41. ;;
  42. *)
  43. echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
  44. exit 1
  45. ;;
  46. esac
  47. exit 0