123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #!/bin/bash
- #
- # munchclient Startup script for munchclient
- #
- # chkconfig: 2345 12 88
- # description: Munchclient collects HTTP requests and sends them to the ScraperWall queue
- ### BEGIN INIT INFO
- # Provides: $syslog
- # Required-Start: $local_fs $network
- # Required-Stop: $local_fs $network
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: ScraperWall HTTP request collector
- # Description: Munchclient is the ScraperWall HTTP-request collector
- ### END INIT INFO
- # Source function library.
- . /etc/init.d/functions
- RETVAL=0
- PIDFILE=/var/run/munchclient.pid
- prog=munchclient
- exec=/usr/bin/$prog
- cmd="/usr/bin/god --nohup --logfile /var/log/munchclient.log --pidfile $PIDFILE --rundir /tmp -- /usr/bin/munchclient -config /etc/munchclient.toml"
- lockfile=/var/lock/subsys/$prog
- # Source config
- if [ -f /etc/default/$prog ] ; then
- source /etc/default/$prog
- fi
- start() {
- [ -x $exec ] || exit 5
- umask 077
- echo -n $"Starting ScraperWall request collector: "
- daemon --pidfile="$PIDFILE" $cmd
- RETVAL=$?
- echo
- [ $RETVAL -eq 0 ] && touch $lockfile
- return $RETVAL
- }
- stop() {
- echo -n $"Shutting down ScraperWall request collector: "
- killproc -p "$PIDFILE" $exec
- RETVAL=$?
- echo
- [ $RETVAL -eq 0 ] && rm -f $lockfile
- return $RETVAL
- }
- rhstatus() {
- status -p "$PIDFILE" -l $prog $exec
- }
- restart() {
- stop
- start
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- reload)
- exit 3
- ;;
- force-reload)
- restart
- ;;
- status)
- rhstatus
- ;;
- condrestart|try-restart)
- rhstatus >/dev/null 2>&1 || exit 0
- restart
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
- exit 3
- esac
- exit $?
|