Skip to content

Commit

Permalink
make t_server_null 'server alive?' check more robust
Browse files Browse the repository at this point in the history
- use "$RUN_SUDO kill -0 $pid" to test if a given process is running, not
  "ps -p $pid" - the latter will not work if security.bsd.see_other_uids=0
  is set

- produce proper error messages if pid files can not be found or are
  empty at server shutdown time

Acked-by: Frank Lichtenheld <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg29314.html

Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
cron2 committed Sep 19, 2024
1 parent 2cc77de commit b322690
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/t_server_null_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ while [ $count -lt $server_max_wait ]; do
# the active server count as the processes won't be running.
for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do
server_pid=$(cat $i.pid 2> /dev/null)
if ps -p $server_pid > /dev/null 2>&1; then
if [ -z "$server_pid" ] ; then
continue
fi
if $RUN_SUDO kill -0 $server_pid > /dev/null 2>&1; then
servers_up=$(( $servers_up + 1 ))
fi
done
Expand Down
5 changes: 5 additions & 0 deletions tests/t_server_null_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ for PID_FILE in $server_pid_files
do
SERVER_PID=$(cat "${PID_FILE}")

if [ -z "$SERVER_PID" ] ; then
echo "WARNING: could not kill server ${PID_FILE}!"
continue
fi

if [ -z "${RUN_SUDO}" ]; then
$KILL_EXEC "${SERVER_PID}"
else
Expand Down

0 comments on commit b322690

Please sign in to comment.