3
# the default Debian ntp.conf enables logging of various statistics to the
4
# /var/log/ntpstats directory. the daemon automatically changes to a new
5
# datestamped set of files at midnight, so all we need to do is delete old
6
# ones, and compress the ones we're keeping so disk usage is controlled
8
if [ -d /var/log/ntpstats ]
10
# only keep a week's depth of these
11
find /var/log/ntpstats -type f -mtime +7 -exec rm {} \;
13
# compress whatever is left to save space
15
ls loopstats.???????? peerstats.???????? > /dev/null 2>&1
19
# note that gzip won't actually compress the filenames that
20
# are actually hard links to the live/current files... so this
21
# compresses yesterday and previous, leaving the live log alone
22
# -- we supress the warnings gzip issues about not compressing
23
# the linked file, which is why this isn't a one-liner
25
gzip --best --quiet loopstats.???????? peerstats.????????
28
2) exit 0 # Squash all warnings
30
*) exit $return # but let real errors through