Skip to content

Instantly share code, notes, and snippets.

@ezotrank
Created June 12, 2013 11:01
Show Gist options
  • Select an option

  • Save ezotrank/5764391 to your computer and use it in GitHub Desktop.

Select an option

Save ezotrank/5764391 to your computer and use it in GitHub Desktop.

Revisions

  1. Maxim Kremenev created this gist Jun 12, 2013.
    40 changes: 40 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #!/bin/bash
    #
    # god Startup script for God monitoring tool.
    #
    # chkconfig: - 85 15
    # description: god monitors your system
    #

    CONF_DIR=/etc/god/*
    PID=/var/run/god.pid
    LOG=/var/log/god.log
    PATH=/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    RETVAL=0

    case "$1" in
    start)
    god -P $PID --no-syslog # -l $LOG --log-level warn
    god load $CONF_DIR
    RETVAL=$?
    ;;
    stop)
    kill `cat $PID`
    RETVAL=$?
    ;;
    restart)
    kill `cat $PID`
    god -P $PID --no-syslog # -l $LOG --log-level warn
    god load $CONF_DIR
    RETVAL=$?
    ;;
    status)
    RETVAL=$?
    ;;
    *)
    echo "Usage: god {start|stop|restart|status}"
    exit 1
    ;;
    esac

    exit $RETVAL