From 06ba5b2c104f5c1c613fdf9085897e56b0912209 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Wed, 11 Mar 2009 12:12:16 -0400 Subject: 2009-03-11 Dave Brolley PR 9936 * stap-find-servers (configuration): Set timeout to 10 seconds. (find_servers): Run avahi-browse in the background and wait for $timeout seconds for it to finish. Kill it if it does not finish. Use a temp file for avahi-browse output. (match_server): Use -t $timeout on read commands. * stap-start-server: Check for $server_pid as a running process and for avahi-publish-service running as a child of $server_pid in order to confirm that the server is running. --- stap-start-server | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'stap-start-server') diff --git a/stap-start-server b/stap-start-server index f1f02d2f..d718ed30 100755 --- a/stap-start-server +++ b/stap-start-server @@ -25,17 +25,20 @@ server_pid=$! # Make sure the server is started for ((attempt=0; $attempt < 10; ++attempt)) do - if test $EUID = 0; then - if ! test -f $sysconfdir/systemtap/ssl/server/stap-server.cert; then - sleep 1 - continue; - fi - elif ! test -f $HOME/.systemtap/ssl/server/stap-server.cert; then + # Has the server started? + if ! (ps -a | grep $server_pid) >/dev/null 2>&1; then sleep 1 continue fi - (ps -a | grep $server_pid) >/dev/null 2>&1 && echo $server_pid && exit 0 - sleep 1 + # Is avahi advertizing the server? + if ! (ps -fa | grep avahi-publish-service | grep $server_pid) > /dev/null 2>&1; then + sleep 1 + continue + fi + + # The server is ready + echo $server_pid + exit 0 done exit 1 # server did not start -- cgit