--- sysstat.in.org 2007-08-11 15:50:32.563753168 +0200 +++ sysstat.in 2007-08-11 15:52:22.750002312 +0200 @@ -10,22 +10,21 @@ RETVAL=0 SYSCONFIG_DIR=@SYSCONFIG_DIR@ -# Remove flag indicating that sadc was successfully launched -rm -f /tmp/sysstat.run # See how we were called. case "$1" in start) + exitCodeIndicator="$(mktemp /tmp/sysstat-XXXXXX)" || exit 1 echo -n "Calling the system activity data collector (sadc): " - @SU_C_OWNER@ @QUOTE@ @SA_LIB_DIR@/sa1 --boot && touch /tmp/sysstat.run @QUOTE@ + @SU_C_OWNER@ @QUOTE@ @SA_LIB_DIR@/sa1 --boot || rm -f ${exitCodeIndicator} @QUOTE@ # Try to guess if sadc was successfully launched. The difficulty # here is that the exit code is lost when the above command is # run via "su foo -c ..." - if [ ! -f /tmp/sysstat.run ]; then - RETVAL=1 + if [ -f "${exitCodeIndicator}" ]; then + rm -f ${exitCodeIndicator} else - rm -f /tmp/sysstat.run + RETVAL=1 fi echo ;;