Skip to content

Instantly share code, notes, and snippets.

@hector
Created February 9, 2022 22:26
Show Gist options
  • Save hector/abe43fc16080f49de46ef83dac440737 to your computer and use it in GitHub Desktop.
Save hector/abe43fc16080f49de46ef83dac440737 to your computer and use it in GitHub Desktop.
God systemd
[Unit]
Description=God: A process monitoring framework in Ruby
After=network.target
[Service]
Restart=always
ExecStart=/etc/god/god.sh start
ExecStop=/etc/god/god.sh stop
[Install]
WantedBy=multi-user.target
#!/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.
#
# Based on: https://raw.githubusercontent.com/mojombo/god/master/init/god
CONF_DIR=/etc/god
RETVAL=0
# Go no further if config directory is missing.
[ -d "$CONF_DIR" ] || exit 0
case "$1" in
start)
# Create pid directory
ruby /usr/bin/god -D -c $CONF_DIR/master.conf
RETVAL=$?
;;
stop)
ruby /usr/bin/god terminate
RETVAL=$?
;;
restart)
ruby /usr/bin/god terminate
ruby /usr/bin/god -D -c $CONF_DIR/master.conf
RETVAL=$?
;;
status)
ruby /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