Created
October 2, 2012 23:15
-
-
Save sletix/3823908 to your computer and use it in GitHub Desktop.
init.d script with mixed pills
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 | |
| ### BEGIN INIT INFO | |
| # Provides: bluepill | |
| # Required-Start: $local_fs $remote_fs $network $syslog $time | |
| # Required-Stop: $local_fs $remote_fs $network $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: bluepill daemon, providing process monitoring | |
| # Description: bluepill is a monitoring tool. More info at http://github.com/arya/bluepill. | |
| ### END INIT INFO | |
| LANG="en_GB.UTF-8" | |
| export LANG | |
| set -e | |
| . /lib/lsb/init-functions | |
| # using system bluepill gem in /usr/local/bin | |
| PATH="$PATH:/usr/local/bin" | |
| # here comes default config | |
| USER="app" | |
| APP_ROOT="/home/app" | |
| PILLS="$APP_ROOT/current/config/pills" | |
| CONFIG="/tmp/vdr-services.pill" | |
| # join pill | |
| cat $PILLS/staging.pill $PILLS/vdr-services.pill > $CONFIG | |
| case "$1" in | |
| start) | |
| echo -n "Starting bluepill for user $USER" | |
| bluepill load $CONFIG | |
| ;; | |
| stop) | |
| echo "Shutting down monitored processes" | |
| bluepill stop | |
| echo "Shutting down bluepill daemon" | |
| bluepill quit | |
| ;; | |
| restart) | |
| ## Stop the service and regardless of whether it was | |
| ## running or not, start it again. | |
| $0 stop | |
| $0 start | |
| ;; | |
| status) | |
| bluepill status | |
| ;; | |
| *) | |
| echo "Usage: $0 {start|stop|restart}" | |
| exit 1 | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment