munchclient 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/bash
  2. #
  3. # munchclient Startup script for munchclient
  4. #
  5. # chkconfig: 2345 12 88
  6. # description: Munchclient collects HTTP requests and sends them to the ScraperWall queue
  7. ### BEGIN INIT INFO
  8. # Provides: $syslog
  9. # Required-Start: $local_fs $network
  10. # Required-Stop: $local_fs $network
  11. # Default-Start: 2 3 4 5
  12. # Default-Stop: 0 1 6
  13. # Short-Description: ScraperWall HTTP request collector
  14. # Description: Munchclient is the ScraperWall HTTP-request collector
  15. ### END INIT INFO
  16. # Source function library.
  17. . /etc/init.d/functions
  18. RETVAL=0
  19. PIDFILE=/var/run/munchclient.pid
  20. prog=munchclient
  21. exec=/usr/bin/$prog
  22. cmd="/usr/bin/god --nohup --logfile /var/log/munchclient.log --pidfile $PIDFILE --rundir /tmp -- /usr/bin/munchclient -config /etc/munchclient.toml"
  23. lockfile=/var/lock/subsys/$prog
  24. # Source config
  25. if [ -f /etc/default/$prog ] ; then
  26. source /etc/default/$prog
  27. fi
  28. start() {
  29. [ -x $exec ] || exit 5
  30. umask 077
  31. echo -n $"Starting ScraperWall request collector: "
  32. daemon --pidfile="$PIDFILE" $cmd
  33. RETVAL=$?
  34. echo
  35. [ $RETVAL -eq 0 ] && touch $lockfile
  36. return $RETVAL
  37. }
  38. stop() {
  39. echo -n $"Shutting down ScraperWall request collector: "
  40. killproc -p "$PIDFILE" $exec
  41. RETVAL=$?
  42. echo
  43. [ $RETVAL -eq 0 ] && rm -f $lockfile
  44. return $RETVAL
  45. }
  46. rhstatus() {
  47. status -p "$PIDFILE" -l $prog $exec
  48. }
  49. restart() {
  50. stop
  51. start
  52. }
  53. case "$1" in
  54. start)
  55. start
  56. ;;
  57. stop)
  58. stop
  59. ;;
  60. restart)
  61. restart
  62. ;;
  63. reload)
  64. exit 3
  65. ;;
  66. force-reload)
  67. restart
  68. ;;
  69. status)
  70. rhstatus
  71. ;;
  72. condrestart|try-restart)
  73. rhstatus >/dev/null 2>&1 || exit 0
  74. restart
  75. ;;
  76. *)
  77. echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
  78. exit 3
  79. esac
  80. exit $?