Sha256: 817c9dc2f6580775a0c78991bf1c254ca214b79ff12ad8cf24b3ed070ef30c82
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
#!/bin/sh HOME=/home/<%= user %> PID_FILE=${PID_FILE:-<%= pid %>/<%= name %>.pid} LOG_FILE=${LOG_FILE:-<%= log %>/<%= name %>.log} STATUS_RUNNING=0 STATUS_DEAD_WITH_PID=1 STATUS_UNKNOWN=4 function checkpid() { [ -z $1 ] && return 1 [ -d /proc/$1 ] && return 0 return 1 } function start() { echo -n "Starting process $0 ..." if [ -s $PID_FILE ] then read pid < $PID_FILE if checkpid $pid 2>&1; then echo "[FAIL] process with PID ${pid} is running." exit $STATUS_UNKNOWN fi fi cd <%= engine.root %>; <%= process.command %> >> $LOG_FILE 2>&1 & if [ $? -eq 0 ]; then echo $! > $PID_FILE echo "[OK]" else echo "[FAIL]" exit $STATUS_UNKNOWN fi } function stop() { echo -n "Terminating process $0 ..." if [ -s $PID_FILE ] then read pid < $PID_FILE if checkpid $pid 2>&1; then kill -TERM $pid rm -f $PID_FILE else echo "[FAIL] process with PID ${pid} does not exist" exit $STATUS_DEAD_WITH_PID fi else echo "[FAIL] pid file $PID_FILE is not found" exit $STATUS_UNKOWN fi } case "$1" in start) start ;; stop) stop ;; *) echo "Usage: $0 {start|stop}" exit 0 esac exit $STATUS_RUNNING
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman-capistrano-0.53.4 | data/export/monit/wrapper.sh.erb |