3 # (C) 1999-2011 Sebastien Godard (sysstat <at> orange.fr)
5 #@(#) @PACKAGE_NAME@-@PACKAGE_VERSION@
6 #@(#) sa1: Collect and store binary data in system activity data file.
10 SYSCONFIG_DIR=@SYSCONFIG_DIR@
11 [ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat
12 if [ ${HISTORY} -gt 28 ]
14 CURRENTDIR=`date +%Y%m`
19 [ -d ${CURRENTDIR} ] || mkdir -p ${CURRENTDIR}
20 # If ${CURRENTFILE} exists and is a regular file, then make sure
21 # the file was modified this day (and not e.g. month ago)
22 # and move it to ${CURRENTDIR}
23 [ ! -L ${CURRENTFILE} ] &&
24 [ -f ${CURRENTFILE} ] &&
25 [ "`date +%Y%m%d -r ${CURRENTFILE}`" = "${CURRENTDIR}${DATE}" ] &&
26 mv -f ${CURRENTFILE} ${CURRENTDIR}/${CURRENTFILE}
27 touch ${CURRENTDIR}/${CURRENTFILE}
28 # Remove the "compatibility" link and recreate it to point to
29 # the (new) current file
31 ln -s ${CURRENTDIR}/${CURRENTFILE} ${CURRENTFILE}
36 [ "$1" = "--boot" ] && shift && BOOT=y || BOOT=n
37 if [ $# = 0 ] && [ "${BOOT}" = "n" ]
39 # Note: Stats are written at the end of previous file *and* at the
40 # beginning of the new one (when there is a file rotation) only if
41 # outfile has been specified as '-' on the command line...
42 exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} 1 1 -
44 exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} $* -