Hehe, my new acronym for god.
The config suggestion I posted earlier works in theory, but I was having some trouble getting it to work from init
What I ended up having to do was add
sleep after some steps of the god init. Multiple sub-config loading from a main config file just wasn’t going to work. I’m am sure there is a better way, but this works for the time being, until I have more free time to work on Unrud itself.
# v.0.0.3
# cobbled by Bryan Taylor http://rubyisbeautiful.com
# god - Start/stop/check Unrud via init
#
# chkconfig: - 85 15
# description: http://god.rubyforge.org/
# processname: god
# config: /etc/god.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/bin/god ] || exit 0
RETVAL=0
prog="god"
start() {
# Start daemon only
echo -n $"Starting $prog: "
/usr/bin/god
sleep 5
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
#load the configs
if [ -e /u/apps/content/current/config/content.god ] ; then
echo -n $"Loading content config: "
/usr/bin/god load /u/apps/content/current/config/content.god
echo -n $"Loading admin config: "
/usr/bin/god load /u/apps/admin/current/config/admin.god
sleep 5
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
else
RETVAL=1
fi
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
/usr/bin/god quit &
sleep 5
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
reload() {
echo -n "$reloading $prog config: "
/usr/bin/god load /u/apps/content/current/config/content.god
/usr/bin/god load /u/apps/admin/current/config/admin.god
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
/usr/bin/god status
RETVAL=$?
;;
*)
echo "Usage: god {start|stop|reload|restart|status}"
exit 1
;;
esac
exit $RETVAL
Also, I modified the init script a little, as god doesn’t quite behave like a typical *nix daemon.
micro theme by seaofclouds, and powered with Mephisto Hosting by hostingrails.com
Sorry, comments are closed for this article.