Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: myservice
  4. # Required-Start: $remote_fs $syslog
  5. # Required-Stop: $remote_fs $syslog
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: Put a short description of the service here
  9. # Description: Put a long description of the service here
  10. ### END INIT INFO
  11.  
  12. # Change the next 3 lines to suit where you have mystic installed,
  13. # what remote mrc server to connect to, and on which port
  14. # Most likley you only need to set the dir
  15. DIR=/path/to/mystic
  16. REMOTE_SERVER=mrc.bottomlessabyss.net
  17. PORT=5000
  18.  
  19. # user to run the script as. This should probably be the same user you run mystic as
  20. DAEMON_USER=mystic
  21.  
  22.  
  23. ## DO NOT EDIT BELOW THIS LINE ##
  24.  
  25.  
  26. DAEMON=$DIR/mrc_client.py
  27. DAEMON_NAME=mrc_client
  28. DAEMON_OPTS="$REMOTE_SERVER $PORT"
  29.  
  30. # The process ID of the script when it runs is stored here:
  31. PIDFILE=/var/run/$DAEMON_NAME.pid
  32. . /lib/lsb/init-functions
  33. do_start () {
  34. log_daemon_msg "Starting system $DAEMON_NAME daemon"
  35. start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON $DAEMON_OPTS > $DIR/logs/mrc_client.log 2>&1
  36. log_end_msg $?
  37. }
  38. do_stop () {
  39. log_daemon_msg "Stopping system $DAEMON_NAME daemon"
  40. start-stop-daemon --stop --pidfile $PIDFILE --retry 10
  41. log_end_msg $?
  42. }
  43. case "$1" in
  44. start|stop)
  45. do_${1}
  46. ;;
  47. restart|reload|force-reload)
  48. do_stop
  49. do_start
  50. ;;
  51. status)
  52. status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
  53. ;;
  54. *)
  55. echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
  56. exit 1
  57. ;;
  58. esac
  59. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement