Advertisement
Guest User

Untitled

a guest
Oct 13th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides: myservice
  5. # Required-Start: $all
  6. # Required-Stop:
  7. # Default-Start: 2 3 4 5
  8. # Default-Stop: 0 1 6
  9. # Short-Description: SIRP Daemon
  10. # Description: SIRP Daemon
  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/pi
  15. DAEMON=/usr/bin/mono
  16. DAEMON_NAME=sirpd
  17. SCRIPTNAME=/etc/init.d/sirpd
  18.  
  19. # Add any command line options for your daemon here
  20. DAEMON_OPTS="/home/pi/sirp.exe"
  21.  
  22. # This next line determines what user the script runs as.
  23. # Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.
  24. DAEMON_USER=pi
  25.  
  26. # The process ID of the script when it runs is stored here:
  27. PIDFILE=/var/run/$DAEMON_NAME.pid
  28.  
  29. . /lib/lsb/init-functions
  30.  
  31. do_start () {
  32. log_daemon_msg "Starting system $DAEMON_NAME daemon"
  33. start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
  34. log_end_msg $?
  35. }
  36. do_stop () {
  37. log_daemon_msg "Stopping system $DAEMON_NAME daemon"
  38. start-stop-daemon --stop --pidfile $PIDFILE --retry 10
  39. log_end_msg $?
  40. }
  41.  
  42. case "$1" in
  43.  
  44. start|stop)
  45. do_${1}
  46. ;;
  47.  
  48. restart|reload|force-reload)
  49. do_stop
  50. do_start
  51. ;;
  52.  
  53. status)
  54. status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
  55. ;;
  56. *)
  57. echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
  58. exit 1
  59. ;;
  60.  
  61. esac
  62. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement