4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1d387a165eed/ Changeset: 1d387a165eed User: nsoranzo Date: 2015-01-24 00:24:17+00:00 Summary: Use spaces instead of tabs. Affected #: 1 file diff -r 49d651198b3a7756936c4b578ccdd824b2c55e4e -r 1d387a165eedb70f81baac629128e3c8be40ac7e rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -2,18 +2,18 @@ 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 + # 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 } # If there is a .venv/ directory, assume it contains a virtualenv that we @@ -37,30 +37,30 @@ servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' $GALAXY_CONFIG_FILE | 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 $GALAXY_CONFIG_FILE --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) - printf "." - sleep 1 - done - echo + # 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 $GALAXY_CONFIG_FILE --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) + printf "." + sleep 1 + done + echo done https://bitbucket.org/galaxy/galaxy-central/commits/228796a3cafc/ Changeset: 228796a3cafc User: nsoranzo Date: 2015-01-24 00:40:41+00:00 Summary: Reduce differences with run.sh . Affected #: 1 file diff -r 1d387a165eedb70f81baac629128e3c8be40ac7e -r 228796a3cafcca474319c7b71f1633349d024dbe rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -1,4 +1,5 @@ #!/bin/sh + cd `dirname $0` check_if_not_started(){ @@ -23,6 +24,15 @@ . .venv/bin/activate fi +python ./scripts/check_python.py +[ $? -ne 0 ] && exit 1 + +./scripts/common_startup.sh + +if [ -n "$GALAXY_UNIVERSE_CONFIG_DIR" ]; then + python ./scripts/build_universe_config.py "$GALAXY_UNIVERSE_CONFIG_DIR" +fi + if [ -z "$GALAXY_CONFIG_FILE" ]; then if [ -f universe_wsgi.ini ]; then GALAXY_CONFIG_FILE=universe_wsgi.ini https://bitbucket.org/galaxy/galaxy-central/commits/40958c314026/ Changeset: 40958c314026 User: nsoranzo Date: 2015-01-24 01:04:13+00:00 Summary: Simplify code. Check if a server process died. Affected #: 1 file diff -r 228796a3cafcca474319c7b71f1633349d024dbe -r 40958c314026031614321b421e84d41c0513df5c rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -2,21 +2,6 @@ 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 -} - # If there is a .venv/ directory, assume it contains a virtualenv that we # should run this instance in. if [ -d .venv ]; @@ -45,11 +30,9 @@ fi servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' $GALAXY_CONFIG_FILE | xargs echo` -for server in $servers; -do +for server in $servers; do # If there's a pid - if [ -e $server.pid ] - then + if [ -e $server.pid ]; then # Then kill it echo "Killing $server" pid=`cat $server.pid` @@ -60,17 +43,19 @@ fi # Start the server (and background) (should this be nohup'd?) python ./scripts/paster.py serve $GALAXY_CONFIG_FILE --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) + while true; do + sleep 1 printf "." - sleep 1 + # Grab the current pid from the pid file + if ! current_pid_in_file=$(cat $server.pid); then + echo "A Galaxy process died, interrupting" >&2 + exit 1 + fi + # Search for all pids in the logs and tail for the last one + latest_pid=`egrep '^Starting server in PID [0-9]+\.$' $server.log -o | sed 's/Starting server in PID //g;s/\.$//g' | tail -n 1` + # If they're equivalent, then the current pid file agrees with our logs + # and we've succesfully started + [ -n "$latest_pid" ] && [ $latest_pid -eq $current_pid_in_file ] && break done echo done https://bitbucket.org/galaxy/galaxy-central/commits/a56fdaab0e25/ Changeset: a56fdaab0e25 User: jmchilton Date: 2015-02-02 14:14:09+00:00 Summary: Merged in nsoranzo/galaxy-central (pull request #647) More enhancements to rolling_restart.sh Affected #: 1 file diff -r 16efc5713d85f631c8ef9ad11895730f4747ea7e -r a56fdaab0e25011febcd98fe376adf39c7ebfb10 rolling_restart.sh --- a/rolling_restart.sh +++ b/rolling_restart.sh @@ -1,21 +1,7 @@ #!/bin/sh + 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 -} - # If there is a .venv/ directory, assume it contains a virtualenv that we # should run this instance in. if [ -d .venv ]; @@ -23,6 +9,15 @@ . .venv/bin/activate fi +python ./scripts/check_python.py +[ $? -ne 0 ] && exit 1 + +./scripts/common_startup.sh + +if [ -n "$GALAXY_UNIVERSE_CONFIG_DIR" ]; then + python ./scripts/build_universe_config.py "$GALAXY_UNIVERSE_CONFIG_DIR" +fi + if [ -z "$GALAXY_CONFIG_FILE" ]; then if [ -f universe_wsgi.ini ]; then GALAXY_CONFIG_FILE=universe_wsgi.ini @@ -35,32 +30,32 @@ fi servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' $GALAXY_CONFIG_FILE | 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 $GALAXY_CONFIG_FILE --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) - printf "." - sleep 1 - done - 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 $GALAXY_CONFIG_FILE --server-name=$server --pid-file=$server.pid --log-file=$server.log --daemon $@ + while true; do + sleep 1 + printf "." + # Grab the current pid from the pid file + if ! current_pid_in_file=$(cat $server.pid); then + echo "A Galaxy process died, interrupting" >&2 + exit 1 + fi + # Search for all pids in the logs and tail for the last one + latest_pid=`egrep '^Starting server in PID [0-9]+\.$' $server.log -o | sed 's/Starting server in PID //g;s/\.$//g' | tail -n 1` + # If they're equivalent, then the current pid file agrees with our logs + # and we've succesfully started + [ -n "$latest_pid" ] && [ $latest_pid -eq $current_pid_in_file ] && break + 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.