Skip to content

Instantly share code, notes, and snippets.

@huacnlee
Created October 22, 2013 10:25
Show Gist options
  • Save huacnlee/7098298 to your computer and use it in GitHub Desktop.
Save huacnlee/7098298 to your computer and use it in GitHub Desktop.
God init.d script 需要 Ubuntu 用 sudo apt-get install god God 配置文件写到 /usr/local/etc/god.rb 里面
#!/bin/bash
#
# god Startup script for god (http://god.rubyforge.org)
#
# chkconfig: - 85 15
# description: God is an easy to configure, easy to extend monitoring \
# framework written in Ruby.
#
CONF=/usr/local/etc/god.rb
RETVAL=0
# Go no further if config directory is missing.
[ -f "$CONF" ] || exit 0
case "$1" in
start)
# Create pid directory
/usr/bin/god -c $CONF -l /var/log/god.log -P /var/run/god.pid
RETVAL=$?
echo "God started. pid: `cat /var/run/god.pid`"
;;
stop)
/usr/bin/god terminate
RETVAL=$?
;;
restart)
/usr/bin/god terminate
/usr/bin/god -c $CONF -l /var/log/god.log -P /var/run/god.pid
RETVAL=$?
echo "God started. pid: `cat /var/run/god.pid`"
;;
status)
/usr/bin/god status
RETVAL=$?
;;
*)
echo "Usage: god {start|stop|restart|status}"
exit 1
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment