diff options
author | Dave Brolley <brolley@redhat.com> | 2009-10-27 17:23:24 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-10-27 17:23:24 -0400 |
commit | 7433d0cf301c9aa35f6322e1930aa7c82ee2dca9 (patch) | |
tree | 8761fa875e8c6649edfdaff3fdde5e3d4b5dfc4b /stap-serverd | |
parent | 465cab03ccad9d50e99431fa1f2da26b9d00b72b (diff) | |
download | systemtap-steved-7433d0cf301c9aa35f6322e1930aa7c82ee2dca9.tar.gz systemtap-steved-7433d0cf301c9aa35f6322e1930aa7c82ee2dca9.tar.xz systemtap-steved-7433d0cf301c9aa35f6322e1930aa7c82ee2dca9.zip |
Specialized user to run stap-server and improved logging.
Diffstat (limited to 'stap-serverd')
-rwxr-xr-x | stap-serverd | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/stap-serverd b/stap-serverd index f89a5f02..ad28a98d 100755 --- a/stap-serverd +++ b/stap-serverd @@ -30,6 +30,7 @@ function initialization { stap_options= uname_r="`uname -r`" arch="`stap_get_arch`" + logfile=/dev/null # Parse the arguments parse_options "$@" @@ -39,7 +40,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" >> $stap_server_logfile + echo "$0: Port $port is busy" >> $logfile port=$((1024+($port + $RANDOM)%64000)) done @@ -57,11 +58,11 @@ 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 >> $stap_server_logfile 2>&1 || exit 1 + ${stap_exec_prefix}stap-gen-cert $ssl_db >> $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 \ - -x `which ${stap_exec_prefix}stap-client`; then + if test -f `which ${stap_exec_prefix}stap-client 2>/dev/null` -a \ + -x `which ${stap_exec_prefix}stap-client 2>/dev/null`; then ${stap_exec_prefix}stap-authorize-server-cert $ssl_db/$stap_certfile fi elif ! test -f $stap_ssl_db/client/cert8.db; then @@ -115,6 +116,10 @@ function parse_options { get_long_arg $first_token $2 ssl_db=$stap_arg ;; + log) + get_long_arg $first_token $2 + logfile=$stap_arg + ;; *) warning "Option '$first_token' ignored" advance_p=$(($advance_p + 1)) @@ -310,9 +315,9 @@ function advertise_presence { # Call avahi-publish-service to advertise our presence. avahi-publish-service "$service_name" \ - $stap_avahi_service_tag $port "$txt" >> $stap_server_logfile 2>&1 & + $stap_avahi_service_tag $port "$txt" >> $logfile 2>&1 & - echo "$service_name listening on port $port" >> $stap_server_logfile + echo "$service_name listening on port $port" >> $logfile } # function: listen @@ -324,7 +329,7 @@ function listen { ${stap_exec_prefix}stap-server-connect \ -p $port -n $nss_cert -d $ssl_db -w $nss_pw \ -s "$stap_options" \ - >> $stap_server_logfile 2>&1 & + >> $logfile 2>&1 & wait '%${stap_exec_prefix}stap-server-connect' >/dev/null 2>&1 } @@ -539,7 +544,7 @@ function check_cert_file { # Warning error # Prints its arguments to stderr function warning { - echo "$0: WARNING:" "$@" >> $stap_server_logfile + echo "$0: WARNING:" "$@" >> $logfile } # function: fatal [ MESSAGE ] @@ -547,7 +552,7 @@ function warning { # Fatal error # Prints its arguments to stderr and exits function fatal { - echo "$0: ERROR:" "$@" >> $stap_server_logfile + echo "$0: ERROR:" "$@" >> $logfile terminate exit 1 } @@ -556,7 +561,7 @@ function fatal { # # Terminate gracefully. function terminate { - echo "$0: Exiting" >> $stap_server_logfile + echo "$0: Exiting" >> $logfile # Kill the running 'avahi-publish-service' job kill -s SIGTERM '%avahi-publish-service' 2> /dev/null |