Last active
August 29, 2015 14:00
-
-
Save kelsin/b0295090ca1c489c8868 to your computer and use it in GitHub Desktop.
God Init Script for my Ubuntu VPS using rbenv
This file contains hidden or 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
| # /root/.bash_profile | |
| export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH" |
This file contains hidden or 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/sh | |
| #/etc/init.d/god | |
| ### BEGIN INIT INFO | |
| # Provides: god | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: God | |
| ### END INIT INFO | |
| NAME=god | |
| DESC=god | |
| set -e | |
| # Create this file and put in a variable called GOD_CONFIG, pointing to | |
| # your God configuration file | |
| GOD_CONFIG=/etc/god/config.god | |
| GOD_PID=/var/run/god.pid | |
| GOD_COMMAND=god | |
| GOD_LOG=/var/log/god.log | |
| . /lib/lsb/init-functions | |
| . /root/.bash_profile | |
| RETVAL=0 | |
| case "$1" in | |
| start) | |
| echo -n "Starting $DESC: " | |
| $GOD_COMMAND -c $GOD_CONFIG -P $GOD_PID -l $GOD_LOG | |
| RETVAL=$? | |
| echo "$NAME." | |
| ;; | |
| stop) | |
| echo -n "Stopping $DESC: " | |
| kill `cat $GOD_PID` | |
| RETVAL=$? | |
| echo "$NAME." | |
| ;; | |
| restart) | |
| echo -n "Restarting $DESC: " | |
| kill `cat $GOD_PID` | |
| $GOD_COMMAND -c $GOD_CONFIG -P $GOD_PID -l $GOD_LOG | |
| RETVAL=$? | |
| echo "$NAME." | |
| ;; | |
| status) | |
| $GOD_COMMAND status | |
| RETVAL=$? | |
| ;; | |
| reload) | |
| $GOD_COMMAND load $GOD_CONFIG | |
| RETVAL=$? | |
| ;; | |
| *) | |
| echo "Usage: god {start|stop|restart|status|reload}" | |
| exit 1 | |
| ;; | |
| esac | |
| exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment