Created
February 9, 2022 22:26
-
-
Save hector/abe43fc16080f49de46ef83dac440737 to your computer and use it in GitHub Desktop.
God systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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