3 # (C) 1999-2013 Sebastien Godard (sysstat <at> orange.fr)
5 #@(#) @PACKAGE_NAME@-@PACKAGE_VERSION@
6 #@(#) sa1: Collect and store binary data in system activity data file.
9 # Set default value for some variables.
10 # Used only if ${SYSCONFIG_DIR}/sysstat doesn't exist!
16 CURRENTDIR=`date +%Y%m`
17 SYSCONFIG_DIR=@SYSCONFIG_DIR@
20 [ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat
21 if [ ${HISTORY} -gt 28 ]
24 [ -d ${CURRENTDIR} ] || mkdir -p ${CURRENTDIR}
25 # If ${CURRENTFILE} exists and is a regular file, then make sure
26 # the file was modified this day (and not e.g. month ago)
27 # and move it to ${CURRENTDIR}
28 [ ! -L ${CURRENTFILE} ] &&
29 [ -f ${CURRENTFILE} ] &&
30 [ "`date +%Y%m%d -r ${CURRENTFILE}`" = "${CURRENTDIR}${DATE}" ] &&
31 mv -f ${CURRENTFILE} ${CURRENTDIR}/${CURRENTFILE}
32 touch ${CURRENTDIR}/${CURRENTFILE}
33 # Remove the "compatibility" link and recreate it to point to
34 # the (new) current file
36 ln -s ${CURRENTDIR}/${CURRENTFILE} ${CURRENTFILE}
38 # If ${CURRENTFILE} exists, is a regular file and is from a previous
39 # month then delete it so that it is recreated by sadc afresh
40 [ -f ${CURRENTFILE} ] && [ "`date +%Y%m -r ${CURRENTFILE}`" -lt "${CURRENTDIR}" ] && rm -f ${CURRENTFILE}
45 [ "$1" = "--boot" ] && shift && BOOT=y || BOOT=n
46 if [ $# = 0 ] && [ "${BOOT}" = "n" ]
48 # Note: Stats are written at the end of previous file *and* at the
49 # beginning of the new one (when there is a file rotation) only if
50 # outfile has been specified as '-' on the command line...
51 exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} 1 1 -
53 exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} $* -