SHARE
TWEET

Untitled

a guest Oct 18th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          shutdown
  5. # Required-Start:    $remote_fs $syslog
  6. # Required-Stop:     $remote_fs $syslog
  7. # Default-Start:     2 3 4 5
  8. # Default-Stop:      0 1 6
  9. # Short-Description: Put a short description of the service here
  10. # Description:       Put a long description of the service here
  11. ### END INIT INFO
  12.  
  13. # Change the next 3 lines to suit where you install your script and what you want to call it
  14. DIR=/home/mendel
  15. DAEMON=$DIR/gpio.py
  16. DAEMON_NAME=shutdown
  17.  
  18. # Add any command line options for your daemon here
  19. DAEMON_OPTS=""
  20.  
  21. # This next line determines what user the script runs as.
  22. # Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.
  23. DAEMON_USER=root
  24.  
  25. # The process ID of the script when it runs is stored here:
  26. PIDFILE=/var/run/$DAEMON_NAME.pid
  27.  
  28. . /lib/lsb/init-functions
  29.  
  30. do_start () {
  31.     log_daemon_msg "Starting system $DAEMON_NAME daemon"
  32.     start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
  33.     log_end_msg $?
  34. }
  35. do_stop () {
  36.     log_daemon_msg "Stopping system $DAEMON_NAME daemon"
  37.     start-stop-daemon --stop --pidfile $PIDFILE --retry 10
  38.     log_end_msg $?
  39. }
  40.  
  41. case "$1" in
  42.  
  43.     start|stop)
  44.         do_${1}
  45.         ;;
  46.  
  47.     restart|reload|force-reload)
  48.         do_stop
  49.         do_start
  50.         ;;
  51.  
  52.     status)
  53.         status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
  54.         ;;
  55.  
  56.     *)
  57.         echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
  58.         exit 1
  59.         ;;
  60.  
  61. esac
  62. exit 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top