-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run as a daemon #38
Comments
Hey Zack, so I'm definitely not an expert, but this is the init.d script that one of our ops people put together for me: #!/bin/bash
. /etc/rc.d/init.d/functions
PATH=/usr/local/bin:${PATH}
CMD="boomcatch --prefix rum. --referer '^https?://(localhost:5400|([\w-]+\.)?(nature|palgrave(-journals|connect))\.com)(/.*)?$' --fwdHost graphite.npgsrv.com --fwdPort 8125 --port 8080 --syslog local0 --mapper statsd-npg > /dev/null 2>&1 &"
app_pid() {
echo `ps -aefw | grep "node /usr/local/bin/boomcatch" | grep -v " grep " | awk '{print $2}'`
}
case "$1" in
start)
echo -n "Starting boomcatch: "
daemon --user boomcatch $CMD && echo_success || echo_failure
echo $(app_pid) > /var/run/boomcatch.pid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/boomcatch
;;
stop)
if test "x`pidofproc boomcatch`" != x; then
echo -n "Stopping boomcatch: "
killproc boomcatch
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/boomcatch /var/run/boomcatch.pid
;;
status)
status boomcatch
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: boomcatch {start|stop|status|restart}"
exit 1
;;
esac Note that we're running on port 8080 because it is behind Nginx in our set-up. I guess I need to document daemonizing boomcatch in the readme. I've held off until now because I'm worried I don't really know what I'm talking about. :-/ EDIT: Added missing shebang to source listing. |
Awesome! Thanks @philbooth! I talked to a colleague about this issue prior to your response, and he guided me toward runit, which made it really easy to keep the server running. I simply had to add the following run script: #!/bin/sh
exec boomcatch --port 8128 --fwdPort 8127 I am happy to close this issue; however, I think you would be well served to have a suggestion or (gasp) official init script for Boomcatch. Your call, but it would be really helpful for others. |
Yeah, you're right. I'll leave this issue open until there is either documentation or a script. |
Do you have a recommended way to run Boomcatch as a daemon? If you happen to have an init.d script, that would be even better.
Thanks!
The text was updated successfully, but these errors were encountered: