diff -ur sysstat-10.1.5.orig/sa1.in sysstat-10.1.5/sa1.in
--- sysstat-10.1.5.orig/sa1.in 2012-05-13 15:00:56.000000000 +0200
+++ sysstat-10.1.5/sa1.in 2014-09-01 21:56:13.197869126 +0200
@@ -10,15 +10,15 @@
# Used only if ${SYSCONFIG_DIR}/sysstat doesn't exist!
HISTORY=0
SADC_OPTIONS=""
-
+DDIR=@SA_DIR@
+DATE=`date +%d`
+CURRENTFILE=sa${DATE}
+CURRENTDIR=`date +%Y%m`
SYSCONFIG_DIR=@SYSCONFIG_DIR@
+umask 0022
[ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat
if [ ${HISTORY} -gt 28 ]
then
- CURRENTDIR=`date +%Y%m`
- DATE=`date +%d`
- CURRENTFILE=sa${DATE}
- DDIR=@SA_DIR@
cd ${DDIR} || exit 1
[ -d ${CURRENTDIR} ] || mkdir -p ${CURRENTDIR}
# If ${CURRENTFILE} exists and is a regular file, then make sure
@@ -33,8 +33,11 @@
# the (new) current file
rm -f ${CURRENTFILE}
ln -s ${CURRENTDIR}/${CURRENTFILE} ${CURRENTFILE}
+else
+ # If ${CURRENTFILE} exists, is a regular file and is from a previous
+ # month then delete it so that it is recreated by sadc afresh
+ [ -f ${CURRENTFILE} ] && [ "`date +%Y%m -r ${CURRENTFILE}`" -lt "${CURRENTDIR}" ] && rm -f ${CURRENTFILE}
fi
-umask 0022
ENDIR=@SA_LIB_DIR@
cd ${ENDIR}
[ "$1" = "--boot" ] && shift && BOOT=y || BOOT=n