Last active
June 21, 2016 10:00
-
-
Save pinglamb/fc535ac839e9017848243c810179a361 to your computer and use it in GitHub Desktop.
Revisions
-
pinglamb renamed this gist
Jun 21, 2016 . 1 changed file with 9 additions and 8 deletions.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 @@ -7,21 +7,21 @@ MY_PIDFILE=tmp/pids/my.pid PUMA_PIDFILE=tmp/pids/puma.pid case $1 in "start") if [ -e $MY_PIDFILE ] then echo "PID file $MY_PIDFILE found, please run \"rails_server stop\" first" exit 1 fi if [ -e $PUMA_PIDFILE ] then echo "PID file $PUMA_PIDFILE found, please run \"rails_server stop\" first" exit 1 fi start_server () { bundle exec puma config.ru -d --pidfile $PUMA_PIDFILE --redirect-stdout log/puma.log --redirect-stderr log/puma.log } start_server @@ -32,13 +32,14 @@ case $1 in then start_server else bundle exec pumactl --pidfile $PUMA_PIDFILE stop start_server fi done > log/puma.log 2>&1& echo $! > $MY_PIDFILE ;; "stop") test -e $MY_PIDFILE && ps --pid $(cat $MY_PIDFILE) &>/dev/null if [ $? -eq 0 ] then @@ -52,14 +53,14 @@ case $1 in test -e $PUMA_PIDFILE && ps --pid $(cat $PUMA_PIDFILE) &>/dev/null if [ $? -eq 0 ] then bundle exec pumactl --pidfile $PUMA_PIDFILE stop echo "Turned off Puma" else echo "Puma is not running" fi rm -f $PUMA_PIDFILE ;; *) echo "Usage: rails_server start|stop" ;; esac -
pinglamb revised this gist
Jun 14, 2016 . 1 changed file with 57 additions and 11 deletions.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 @@ -6,14 +6,60 @@ MY_PIDFILE=tmp/pids/my.pid PUMA_PIDFILE=tmp/pids/puma.pid case $1 in "on") if [ -e $MY_PIDFILE ] then echo "PID file $MY_PIDFILE found, please run \"server off\" first" exit 1 fi if [ -e $PUMA_PIDFILE ] then echo "PID file $PUMA_PIDFILE found, please run \"server off\" first" exit 1 fi start_server () { puma config.ru -d --pidfile $PUMA_PIDFILE --redirect-stdout log/puma.log --redirect-stderr log/puma.log } start_server nohup inotifywait -m tmp/restart.txt -e attrib -q | while read event; do test -e "$PUMA_PIDFILE" && pumactl --pidfile $PUMA_PIDFILE status if [ $? -ne 0 ] then start_server else pumactl --pidfile $PUMA_PIDFILE restart fi done > log/puma.log 2>&1& echo $! > $MY_PIDFILE ;; "off") test -e $MY_PIDFILE && ps --pid $(cat $MY_PIDFILE) &>/dev/null if [ $? -eq 0 ] then kill -9 $(cat $MY_PIDFILE) echo "Turned off monitor" else echo "Monitor is not running" fi rm -f $MY_PIDFILE test -e $PUMA_PIDFILE && ps --pid $(cat $PUMA_PIDFILE) &>/dev/null if [ $? -eq 0 ] then pumactl --pidfile $PUMA_PIDFILE stop echo "Turned off Puma" else echo "Puma is not running" fi rm -f $PUMA_PIDFILE ;; *) echo "Usage: server on|off" ;; esac -
pinglamb revised this gist
Jun 14, 2016 . 1 changed file with 3 additions and 0 deletions.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 @@ -1,5 +1,8 @@ #!/usr/bin/env bash # Dependencies: # - inotify-tools MY_PIDFILE=tmp/pids/my.pid PUMA_PIDFILE=tmp/pids/puma.pid -
pinglamb created this gist
Jun 14, 2016 .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,16 @@ #!/usr/bin/env bash MY_PIDFILE=tmp/pids/my.pid PUMA_PIDFILE=tmp/pids/puma.pid nohup inotifywait -m tmp/restart.txt -e attrib -q | while read event; do test -e "$PUMA_PIDFILE" && pumactl --pidfile $PUMA_PIDFILE status if [ $? -ne 0 ] then puma config.ru -d --pidfile $PUMA_PIDFILE --redirect-stdout log/puma.log --redirect-stderr log/puma.log else pumactl --pidfile $PUMA_PIDFILE restart fi done > log/puma.log 2>&1& echo $! > $MY_PIDFILE