munchclient 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/munchclient
  22. lockfile=/var/lock/subsys/$prog
  23. # Source config
  24. if [ -f /etc/default/$prog ] ; then
  25. . /etc/default/$prog
  26. fi
  27. start() {
  28. [ -x $exec ] || exit 5
  29. umask 077
  30. echo -n $"Starting ScraperWall request collector: "
  31. daemon --pidfile="$PIDFILE" $exec -config /etc/munchclient.toml -pidfile "$PIDFILE"
  32. RETVAL=$?
  33. echo
  34. [ $RETVAL -eq 0 ] && touch $lockfile
  35. return $RETVAL
  36. }
  37. stop() {
  38. echo -n $"Shutting down ScraperWall request collector: "
  39. killproc -p "$PIDFILE" $exec
  40. RETVAL=$?
  41. echo
  42. [ $RETVAL -eq 0 ] && rm -f $lockfile
  43. return $RETVAL
  44. }
  45. rhstatus() {
  46. status -p "$PIDFILE" -l $prog $exec
  47. }
  48. restart() {
  49. stop
  50. start
  51. }
  52. case "$1" in
  53. start)
  54. start
  55. ;;
  56. stop)
  57. stop
  58. ;;
  59. restart)
  60. restart
  61. ;;
  62. reload)
  63. exit 3
  64. ;;
  65. force-reload)
  66. restart
  67. ;;
  68. status)
  69. rhstatus
  70. ;;
  71. condrestart|try-restart)
  72. rhstatus >/dev/null 2>&1 || exit 0
  73. restart
  74. ;;
  75. *)
  76. echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
  77. exit 3
  78. esac
  79. exit $?