Advertisement
Guest User

obworker

a guest
Nov 24th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.27 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          obworker
  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: obworker
  10. # Description:       obworker
  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. DAEMON=/usr/local/bin/obworker
  15. DAEMON_ARGS=
  16. DAEMON_NAME=obworker
  17. DAEMON_USER=ob
  18. PIDFILE=/var/run/$DAEMON_NAME.pid
  19.  
  20. #set -x
  21.  
  22. . /lib/lsb/init-functions
  23.  
  24. do_start () {
  25.     log_daemon_msg "Starting system $DAEMON_NAME daemon"
  26.     start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile -c $DAEMON_USER --startas $DAEMON -- $DAEMON_ARGS
  27.     log_end_msg $?
  28. }
  29. do_stop () {
  30.     log_daemon_msg "Stopping system $DAEMON_NAME daemon"
  31.     start-stop-daemon --stop --pidfile $PIDFILE --retry 10
  32.     log_end_msg $?
  33. }
  34.  
  35. case "$1" in
  36.  
  37.     start|stop)
  38.         do_${1}
  39.         ;;
  40.  
  41.     restart|reload|force-reload)
  42.         do_stop
  43.         do_start
  44.         ;;
  45.  
  46.     status)
  47.         status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
  48.         ;;
  49.     *)
  50.         echo "Usage: /etc/init.d/$DEAMON_NAME {start|stop|restart|status}"
  51.         exit 1
  52.         ;;
  53.  
  54. esac
  55. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement