#!/bin/sh # # (C) 2000-2009 Sebastien Godard (sysstat orange.fr) # # Description: Reset the system activity logs # RETVAL=0 SYSCONFIG_DIR=/etc/sysstat SADC_OPTIONS="-S DISK" sysstat_start() { exitCodeIndicator="$(mktemp /var/run/sysstat-XXXXXX)" || exit 1 echo -n "Calling the system activity data collector (sadc): " /usr/lib/sa/sa1 --boot ${SADC_OPTIONS} || rm -f ${exitCodeIndicator} /usr/lib/sa/sadc -F -L -S ALL - # 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 "${exitCodeIndicator}" ]; then rm -f ${exitCodeIndicator} else RETVAL=1 fi echo } sysstat_stop() { /usr/lib/sa/sa2 -A } # See how we were called. case "$1" in start) sysstat_start ;; stop) sysstat_stop ;; status) ;; restart|reload) sysstat_stop sleep 1 sysstat_start ;; *) echo "Usage: sysstat {start|stop|status|restart|reload}" exit 1 esac exit ${RETVAL}