diff options
Diffstat (limited to 'stap-serverd')
-rwxr-xr-x | stap-serverd | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/stap-serverd b/stap-serverd index 431d03e9..f89a5f02 100755 --- a/stap-serverd +++ b/stap-serverd @@ -29,7 +29,7 @@ function initialization { ssl_db= stap_options= uname_r="`uname -r`" - arch="`get_arch`" + arch="`stap_get_arch`" # Parse the arguments parse_options "$@" @@ -39,7 +39,7 @@ function initialization { while netstat -atn | awk '{print $4}' | cut -f2 -d: | egrep -q "^$port\$"; do # Whoops, the port is busy; try another one. - echo "$0: Port $port is busy" + echo "$0: Port $port is busy" >> $stap_server_logfile port=$((1024+($port + $RANDOM)%64000)) done @@ -57,7 +57,7 @@ function initialization { # If no certificate/key database has been specified, then find/create # a local one. if ! test -f $ssl_db/$stap_certfile; then - ${stap_exec_prefix}stap-gen-cert $ssl_db || exit 1 + ${stap_exec_prefix}stap-gen-cert $ssl_db >> $stap_server_logfile 2>&1 || exit 1 # Now add the server's certificate to the client's database, # making it a trusted peer. Do this only if the client has been installed. if test -f `which ${stap_exec_prefix}stap-client` -a \ @@ -282,7 +282,7 @@ function process_r { if test "$first_char" = "/"; then # fully specified path kernel_build_tree=$1 version_file_name="$kernel_build_tree/include/config/kernel.release" - # The file include/config/kernel.release within the + # The file include/config/kernel.release within the kernel # build tree is used to pull out the version information release=`cat $version_file_name 2>/dev/null` if test "X$release" = "X"; then @@ -305,13 +305,14 @@ function process_r { # Advertise the availability of the server on the network. function advertise_presence { # Build up a string representing our server's properties. + local service_name="Systemtap Compile Server for $uname_r $arch" local txt="sysinfo=$uname_r $arch" # Call avahi-publish-service to advertise our presence. - avahi-publish-service "Systemtap Compile Server on `uname -n`" \ - $stap_avahi_service_tag $port "$txt" > /dev/null & + avahi-publish-service "$service_name" \ + $stap_avahi_service_tag $port "$txt" >> $stap_server_logfile 2>&1 & - echo "Systemtap Compile Server on `uname -n` listening on port $port" + echo "$service_name listening on port $port" >> $stap_server_logfile } # function: listen @@ -323,7 +324,7 @@ function listen { ${stap_exec_prefix}stap-server-connect \ -p $port -n $nss_cert -d $ssl_db -w $nss_pw \ -s "$stap_options" \ - 2>&1 & + >> $stap_server_logfile 2>&1 & wait '%${stap_exec_prefix}stap-server-connect' >/dev/null 2>&1 } @@ -538,7 +539,7 @@ function check_cert_file { # Warning error # Prints its arguments to stderr function warning { - echo "$0: WARNING:" "$@" >&2 + echo "$0: WARNING:" "$@" >> $stap_server_logfile } # function: fatal [ MESSAGE ] @@ -546,7 +547,7 @@ function warning { # Fatal error # Prints its arguments to stderr and exits function fatal { - echo "$0: ERROR:" "$@" >&2 + echo "$0: ERROR:" "$@" >> $stap_server_logfile terminate exit 1 } @@ -555,7 +556,7 @@ function fatal { # # Terminate gracefully. function terminate { - echo "$0: Exiting" + echo "$0: Exiting" >> $stap_server_logfile # Kill the running 'avahi-publish-service' job kill -s SIGTERM '%avahi-publish-service' 2> /dev/null |