Use separate pid_log_paster_args variable

to store --pid-file and --log-file options of `./scripts/paster.py` .

https://github.com/galaxyproject/galaxy/pull/6239 fixed 3 bugs:

- `GALAXY_RUN_ALL=1 ./run.sh` was reusing the same pid and log files for
  all Galaxy processes;
- `./run.sh restart` was always using `paster.pid` and `paster.log` instead
  of the configured files
- `./run.sh status` was always using `paster.pid`

but also introduced a regression, i.e. the plain `./run.sh` started
writing to the log file instead of the standard output (console).

This fixes the regression by using a separate variable for these options
instead of conflating them in `paster_args` or `server_args`.
This commit is contained in:
Nicola Soranzo
2018-06-01 14:59:25 +01:00
parent b137d5cf34
commit 0ea8107191
4 changed files with 22 additions and 20 deletions
+4 -6
View File
@@ -78,8 +78,9 @@ if [ "$run_server" = "python" -a -n "$GALAXY_RUN_ALL" ]; then
exit 1
fi
for server in $servers; do
echo "Executing: python $server_args --server-name=\"$server\" --pid-file=\"$server.pid\" --log-file=\"$server.log\""
python $server_args --server-name="$server" --pid-file="$server.pid" --log-file="$server.log"
if [ -n "$wait_arg_set" -a -n "$daemon_or_restart_arg_set" ]; then
python ./scripts/paster.py serve "$GALAXY_CONFIG_FILE" --server-name="$server" --pid-file="$server.pid" --log-file="$server.log" $paster_args
while true; do
sleep 1
printf "."
@@ -95,13 +96,10 @@ if [ "$run_server" = "python" -a -n "$GALAXY_RUN_ALL" ]; then
[ -n "$latest_pid" ] && [ "$latest_pid" -eq "$current_pid_in_file" ] && break
done
echo
else
echo "Handling $server with log file $server.log..."
python ./scripts/paster.py serve "$GALAXY_CONFIG_FILE" --server-name="$server" --pid-file="$server.pid" --log-file="$server.log" $paster_args
fi
done
else
echo "executing: $run_server $server_args"
echo "Executing: $run_server $server_args $pid_log_paster_args"
# args are properly quoted so use eval
eval $run_server $server_args
eval $run_server $server_args $pid_log_paster_args
fi
+2 -2
View File
@@ -48,5 +48,5 @@ if [ -n "$GALAXY_REPORTS_CONFIG_DIR" ]; then
fi
find_server ${GALAXY_REPORTS_CONFIG:-none} reports
echo "executing: $run_server $server_args"
eval $run_server $server_args
echo "Executing: $run_server $server_args $pid_log_paster_args"
eval $run_server $server_args $pid_log_paster_args
+2 -2
View File
@@ -37,5 +37,5 @@ if [ -z "$TOOL_SHED_CONFIG_FILE" ]; then
fi
find_server ${TOOL_SHED_CONFIG_FILE:-none} tool_shed
echo "executing: $run_server $server_args"
eval $run_server $server_args
echo "Executing: $run_server $server_args $pid_log_paster_args"
eval $run_server $server_args $pid_log_paster_args
+14 -10
View File
@@ -22,30 +22,33 @@ parse_common_args() {
--stop-daemon|stop)
common_startup_args="$common_startup_args --stop-daemon"
paster_args="$paster_args --stop-daemon"
uwsgi_args="$uwsgi_args --stop $PID_FILE"
pid_log_paster_args="--pid-file \"$PID_FILE\""
uwsgi_args="$uwsgi_args --stop \"$PID_FILE\""
stop_daemon_arg_set=1
shift
;;
--restart|restart)
if [ "$1" = "--restart" ]
then
paster_args="$paster_args restart"
else
paster_args="$paster_args $1"
fi
uwsgi_args="$uwsgi_args --reload $PID_FILE"
paster_args="$paster_args restart"
pid_log_paster_args="--pid-file \"$PID_FILE\" --log-file \"$LOG_FILE\""
uwsgi_args="$uwsgi_args --reload \"$PID_FILE\""
restart_arg_set=1
daemon_or_restart_arg_set=1
shift
;;
--daemon|start)
paster_args="$paster_args --daemon"
pid_log_paster_args="--pid-file \"$PID_FILE\" --log-file \"$LOG_FILE\""
# --daemonize2 waits until after the application has loaded
# to daemonize, thus it stops if any errors are found
uwsgi_args="--master --daemonize2 $LOG_FILE --pidfile2 $PID_FILE $uwsgi_args"
uwsgi_args="--master --daemonize2 \"$LOG_FILE\" --pidfile2 \"$PID_FILE\" $uwsgi_args"
daemon_or_restart_arg_set=1
shift
;;
--status|status)
paster_args="$paster_args $1"
pid_log_paster_args="--pid-file \"$PID_FILE\""
shift
;;
--wait)
wait_arg_set=1
shift
@@ -115,8 +118,9 @@ find_server() {
server_args="$(python ./scripts/get_uwsgi_args.py $arg_getter_args)"
fi
server_args="$server_args $uwsgi_args"
pid_log_paster_args=""
else
run_server="python"
server_args="./scripts/paster.py serve $server_config --pid-file $PID_FILE --log-file $LOG_FILE $paster_args"
server_args="./scripts/paster.py serve $server_config $paster_args"
fi
}