I have a script that runs every 4 hours to find anything > today and compress it if it is not compressed. Some times it compresses all members in the directory that qualify and other times it does not. The script is executed from the cron. We have looked at the code and cannot see why it is acting the way it does. I rerun and it compresses the ones it missed before.
CRON................
0 00,04,08,12,16,20 * * * /tasc/bin/uxtar_log_cleanup.sh
SCRIPT uxtar_log_cleanup.sh
#!/bin/ksh
# Compress logs > 1 day old.
DTE=`date +%m%d%y%H%M`
LOGDIR="/tasc/logs"
LOGFILE=/tasc/logs/xstar_log_cleanup.log${DTE}
exec 1>$LOGFILE 2>&1
#
# compress members greater than 1 day in /tasc/logs
#
#
find ${LOGDIR} ! -name '*.Z' -mtime +0 -exec compress {} \;
DIRECTORY /tasc/logs
a few members after the scripts executed.
-rw-r--r-- 1 ustar ustar 960 Apr 6 05:08 RBMPsend_NEW040604042707.Z
-rw-r--r-- 1 ustar ustar 1824 Apr 6 05:28 ustar_processB.log.0406040528.Z
-rw-r--r-- 1 ustar ustar 1594 Apr 6 07:52 RBMPsend_NEW040604072503 <-Did not compress
-rw-r--r-- 1 ustar ustar 360 Apr 6 08:00 ustar_log_cleanup.log0406040800.Z
CRON................
0 00,04,08,12,16,20 * * * /tasc/bin/uxtar_log_cleanup.sh
SCRIPT uxtar_log_cleanup.sh
#!/bin/ksh
# Compress logs > 1 day old.
DTE=`date +%m%d%y%H%M`
LOGDIR="/tasc/logs"
LOGFILE=/tasc/logs/xstar_log_cleanup.log${DTE}
exec 1>$LOGFILE 2>&1
#
# compress members greater than 1 day in /tasc/logs
#
#
find ${LOGDIR} ! -name '*.Z' -mtime +0 -exec compress {} \;
DIRECTORY /tasc/logs
a few members after the scripts executed.
-rw-r--r-- 1 ustar ustar 960 Apr 6 05:08 RBMPsend_NEW040604042707.Z
-rw-r--r-- 1 ustar ustar 1824 Apr 6 05:28 ustar_processB.log.0406040528.Z
-rw-r--r-- 1 ustar ustar 1594 Apr 6 07:52 RBMPsend_NEW040604072503 <-Did not compress
-rw-r--r-- 1 ustar ustar 360 Apr 6 08:00 ustar_log_cleanup.log0406040800.Z