From: Chris <cpo...@em...> - 2017-02-12 14:56:16
|
This is a logrotate configuration file that I modified from what Matthias had put out about 10yrs ago. I modified it to fit my needs: /home/chris/fetchmaillog { weekly rotate 8 compress dateext missingok notifempty create 0664 chris chris sharedscripts postrotate /usr/local/bin/fetchmail --quit /usr/local/bin/fetchmail -v --nokeep --nosyslog --logfile /home/chris/fetchmaillog --uidl -m procmail endscript } This is the command to execute the rotation Sunday mornings at 8am. For some reason without the -f it will tell me the log doesn't need rotation. /usr/sbin/logrotate -f -v --state=/home/chris/logrotate/status /home/chris/logrotate/fetchmail.logrotate It ran fine on 5 Feb: reading config file /home/chris/logrotate/fetchmail.logrotate Handling 1 logs rotating pattern: /home/chris/fetchmaillog forced from command line (8 rotations) empty log files are not rotated, old logs are removed considering log /home/chris/fetchmaillog log needs rotating rotating log /home/chris/fetchmaillog, log->rotateCount is 8 dateext suffix '-20170205' glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' renaming /home/chris/fetchmaillog to /home/chris/fetchmaillog-20170205 creating new /home/chris/fetchmaillog mode = 0664 uid = 1000 gid = 1000 running postrotate script fetchmail: background fetchmail at 1700 killed. compressing log with: /bin/gzip Although to be honest I can't recall if it was restarted or not. That's why I have it running at 8am when I can observe. When logrotate was run this morning however: reading config file /home/chris/logrotate/fetchmail.logrotate Handling 1 logs rotating pattern: /home/chris/fetchmaillog forced from command line (8 rotations) empty log files are not rotated, old logs are removed considering log /home/chris/fetchmaillog log needs rotating rotating log /home/chris/fetchmaillog, log->rotateCount is 8 dateext suffix '-20170212' glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' renaming /home/chris/fetchmaillog to /home/chris/fetchmaillog-20170212 creating new /home/chris/fetchmaillog mode = 0664 uid = 1000 gid = 1000 running postrotate script fetchmail: background fetchmail at 3786 killed. fetchmail: can't accept options while a background fetchmail is running. argc = 9, arg list: arg 1 = "-v" arg 2 = "--nokeep" arg 3 = "--nosyslog" arg 4 = "--logfile" arg 5 = "/home/chris/fetchmaillog" arg 6 = "--uidl" arg 7 = "-m" arg 8 = "procmail" error: error running shared postrotate script for '/home/chris/fetchmaillog ' I don't understand why it worked the first time but not the 2nd as nothing was changed in between. Apologies Matthias when I said yesterday it was working. Chris -- Chris KeyID 0xE372A7DA98E6705C 31.11972; -97.90167 (Elev. 1092 ft) 08:40:34 up 9 days, 38 min, 2 users, load average: 0.61, 0.44, 0.34 Ubuntu 16.04.1 LTS, kernel 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 |