Guest User

Untitled

a guest
Nov 7th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: AutoSub
  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: AutoSub
  9. # Description: Script to control AutoSub
  10. ### END INIT INFO
  11.  
  12. ## START EDIT ##
  13.  
  14. NAME=AutoSub
  15. INIT_DIR=/etc/init.d
  16. DAEMON=/usr/bin/python
  17. DAEMON_OPTS="/home/user/autosub/AutoSub.py -c /home/user/autosub/config.properties -d -l"
  18.  
  19.  
  20. ## STOP EDIT ##
  21.  
  22. autosub_start() {
  23. echo "Starting $NAME"
  24. echo "$DAEMON ${DAEMON_OPTS}"
  25. cd /home/dennis/autosub/
  26. $DAEMON ${DAEMON_OPTS}
  27. }
  28. autosub_stop() {
  29. echo "Stopping $NAME"
  30. for pid in $(/bin/pidof python); do
  31. /bin/grep -q "AutoSub.py" /proc/$pid/cmdline && /bin/kill $pid
  32. done
  33. /bin/sleep 2
  34. }
  35.  
  36. case "$1" in
  37. start)
  38. autosub_start
  39. ;;
  40. stop)
  41. autosub_stop
  42. ;;
  43. restart|force-reload)
  44. echo "Restarting $NAME"
  45. autosub_stop
  46. autosub_start
  47. ;;
  48. *)
  49. echo "Usage: $0 {start|stop|restart|force-reload}" >&2
  50. exit 1
  51. ;;
  52. esac
  53. exit 0
Advertisement
Add Comment
Please, Sign In to add comment