commit/galaxy-central: 6 new changesets
6 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/a2892895e566/ Changeset: a2892895e566 User: erasche2 Date: 2014-05-14 21:48:26 Summary: Added rolling restart script to kill servers sequentially Affected #: 1 file diff -r b483d9df129c00480fc72253a277de18ab67b27d -r a2892895e566ebad6edc1401519c72b83138a2a9 rolling_restart.sh --- /dev/null +++ b/rolling_restart.sh @@ -0,0 +1,49 @@ +#!/bin/bash +cd `dirname $0` + +check_if_not_started(){ + # Search for all pids in the logs and tail for the last one + latest_pid=`egrep 'Starting server in PID [0-9]+' $1 -o | sed 's/Starting server in PID //g' | tail -n 1` + # Grab the current pid from the file we were given + current_pid_in_file=$(cat $2); + # If they're equivalent, then the current pid file agrees with our logs + # and we've succesfully started + if [[ $latest_pid -eq $current_pid_in_file ]]; + then + echo 0; + else + echo 1; + fi +} + +servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' universe_wsgi.ini | xargs echo` +for server in $servers; +do + # If there's a pid + if [[ -e $server.pid ]] + then + # Then kill it + echo "Killing $server" + pid=`cat $server.pid` + kill $pid + else + # Otherwise just continue + echo "$server not running" + fi + # Start the server (and background) (should this be nohup'd?) + python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log $@ & + # Wait for the server to start + sleep 1 + # Grab the new pid + pid=`cat $server.pid` + result=1 + # Wait for the latest pid in the file to be the pid we've grabbed + while [[ $result -eq 1 ]] + do + result=$(check_if_not_started $server.log $server.pid) + echo -n "." + sleep 1 + done + echo "" +done + https://bitbucket.org/galaxy/galaxy-central/commits/8bd0ea03bc28/ Changeset: 8bd0ea03bc28 User: erasche2 Date: 2014-05-14 22:23:26 Summary: Removed detach as --daemon flag will detach process Affected #: 1 file diff -r a2892895e566ebad6edc1401519c72b83138a2a9 -r 8bd0ea03bc2877bc7a9fc6880337c3a07706e655 rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -31,7 +31,7 @@ echo "$server not running" fi # Start the server (and background) (should this be nohup'd?) - python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log $@ & + python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log $@ # Wait for the server to start sleep 1 # Grab the new pid https://bitbucket.org/galaxy/galaxy-central/commits/b189178db4ae/ Changeset: b189178db4ae User: erasche2 Date: 2014-05-14 22:33:44 Summary: Added --daemon flag so user doesn't have to Affected #: 1 file diff -r 8bd0ea03bc2877bc7a9fc6880337c3a07706e655 -r b189178db4aef2a3dbe9fbfbe2be4582911f8597 rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -31,7 +31,7 @@ echo "$server not running" fi # Start the server (and background) (should this be nohup'd?) - python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log $@ + python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log --daemon $@ # Wait for the server to start sleep 1 # Grab the new pid https://bitbucket.org/galaxy/galaxy-central/commits/a3530f2474fc/ Changeset: a3530f2474fc User: erasche2 Date: 2014-05-15 16:43:04 Summary: Added line anchors for performance Affected #: 1 file diff -r b189178db4aef2a3dbe9fbfbe2be4582911f8597 -r a3530f2474fc2ccc0529e35cf154615de4474365 rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -3,7 +3,7 @@ check_if_not_started(){ # Search for all pids in the logs and tail for the last one - latest_pid=`egrep 'Starting server in PID [0-9]+' $1 -o | sed 's/Starting server in PID //g' | tail -n 1` + latest_pid=`egrep '^Starting server in PID [0-9]+.$' $1 -o | sed 's/Starting server in PID //g;s/\.$//g' | tail -n 1` # Grab the current pid from the file we were given current_pid_in_file=$(cat $2); # If they're equivalent, then the current pid file agrees with our logs https://bitbucket.org/galaxy/galaxy-central/commits/65ea2c82a973/ Changeset: 65ea2c82a973 User: erasche2 Date: 2014-05-15 16:48:17 Summary: Fixed typo on regex Affected #: 1 file diff -r a3530f2474fc2ccc0529e35cf154615de4474365 -r 65ea2c82a9738f8782a3c06d2ee06d5471ba9bd0 rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -3,7 +3,7 @@ check_if_not_started(){ # Search for all pids in the logs and tail for the last one - latest_pid=`egrep '^Starting server in PID [0-9]+.$' $1 -o | sed 's/Starting server in PID //g;s/\.$//g' | tail -n 1` + latest_pid=`egrep '^Starting server in PID [0-9]+\.$' $1 -o | sed 's/Starting server in PID //g;s/\.$//g' | tail -n 1` # Grab the current pid from the file we were given current_pid_in_file=$(cat $2); # If they're equivalent, then the current pid file agrees with our logs https://bitbucket.org/galaxy/galaxy-central/commits/5f6110335f4e/ Changeset: 5f6110335f4e User: natefoo Date: 2014-05-15 17:33:20 Summary: Merged in erasche2/galaxy-central (pull request #393) Added rolling restart script to kill servers sequentially Affected #: 1 file diff -r 0d2c45f321ed234115a15d46c255818192ba41a2 -r 5f6110335f4e328e6fd1a83c65a9312fcf5caeb0 rolling_restart.sh --- /dev/null +++ b/rolling_restart.sh @@ -0,0 +1,49 @@ +#!/bin/bash +cd `dirname $0` + +check_if_not_started(){ + # Search for all pids in the logs and tail for the last one + latest_pid=`egrep '^Starting server in PID [0-9]+\.$' $1 -o | sed 's/Starting server in PID //g;s/\.$//g' | tail -n 1` + # Grab the current pid from the file we were given + current_pid_in_file=$(cat $2); + # If they're equivalent, then the current pid file agrees with our logs + # and we've succesfully started + if [[ $latest_pid -eq $current_pid_in_file ]]; + then + echo 0; + else + echo 1; + fi +} + +servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' universe_wsgi.ini | xargs echo` +for server in $servers; +do + # If there's a pid + if [[ -e $server.pid ]] + then + # Then kill it + echo "Killing $server" + pid=`cat $server.pid` + kill $pid + else + # Otherwise just continue + echo "$server not running" + fi + # Start the server (and background) (should this be nohup'd?) + python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log --daemon $@ + # Wait for the server to start + sleep 1 + # Grab the new pid + pid=`cat $server.pid` + result=1 + # Wait for the latest pid in the file to be the pid we've grabbed + while [[ $result -eq 1 ]] + do + result=$(check_if_not_started $server.log $server.pid) + echo -n "." + sleep 1 + done + echo "" +done + Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org