Revisions
-
ponchik renamed this gist
Apr 16, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ponchik created this gist
Apr 16, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ #!/bin/bash SCRIPT='cd /web/vcms/; bundle exec sidekiq' RUNAS=dimon NAME=vcms-sidekiq PIDFILE=/web/vcms/tmp/pids/sidekiq.pid LOGFILE=/web/vcms/log/sidekiq.log start() { if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then echo 'Service already running' >&2 exit 1 fi echo 'Starting service...' >&2 cd /web/vcms; sidekiq -d -e production & } stop() { sidekiqctl stop $PIDFILE } status() { printf "%-50s" "Checking $NAME..." if [ -f $PIDFILE ]; then PID=$(cat $PIDFILE) if [ -z "$(ps axf | grep ${PID} | grep -v grep)" ]; then printf "%s\n" "The process appears to be dead but pidfile still exists" else echo "Running, the PID is $PID" fi else printf "%s\n" "Service not running" fi } case "$1" in start) start ;; stop) stop ;; status) status ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|status|restart}" esac