Blame SOURCES/sysstat-10.1.5-overwrite-sa.patch

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