Re: [webmin-l] Rotating fetchmail log
Chris <[email protected]>
| Newsgroups | gmane.comp.web.webmin.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2016-12-27 at 06:28 +0300, Andrey Repin wrote:
> Greetings, Chris!
>
> >
> > On Tue, 2016-12-27 at 03:09 +0300, Andrey Repin wrote:
> > >
> > > Greetings, Chris!
> > >
> > > >
> > > >
> > > > On Mon, 2016-12-26 at 14:18 -0800, Jamie Cameron wrote:
> > > > >
> > > > >
> > > > > Try logging in as root via SSH and running :
> > > > >
> > > > > logrotate -f /etc/logrotate.conf
> > > > >
> > > > Thank you for that. I think I'm getting closer. I now have a
> > > > fetchmail.logrotate file in /etc/logrotate.d which reads
> > >
> > > >
> > > >
> > > > /home/chris/fetchmaillog {
> > > > weekly
> > > > rotate 8
> > > > compress
> > > > datext
> > > > missingok
> > > > notifempty
> > > > create 0664 chris chris
> > > > sharedscripts
> > > > postrotate
> > > > /usr/local/bin/fetchmail --quit; fetchmail -v --nokeep
> > > > --
> > > > nosyslog --logfile /home/chris/fetchmaillog --uidl -m procmail
> > > > fi;
> > > > endscript
> > > > }
> > >
> > > ...
> > >
> > > >
> > > >
> > > > I'm not sure though if the postrotate command will work
> > > > correctly
> > > > since
> > > > the commands below it are not a true script.
> > >
> > > What makes you saying that?
> > >
> > I'm just assuming that since from what I understand in reading the
> > logrotate man page that prerotate and postrotate use a script.
>
>
> pre/postrotate ... endscript blocks DEFINE a script, that will be run
> upon
> appropriate event. Not "use".
>
Thanks Andrey, I understand now. Hoping that it will work the way I
have it setup at least running logrotate -d doesn't give me any errors.
Logrotate runs each morning at 7:30. Checking I see
1629780 Dec 27 07:42 fetchmaillog-20161227
however a couple of issues. 1)the log wasn't compressed and 2)fetchmail
wasn't stopped although the new fetchmaillog was created it wasn't
being written to. The way the fetchmail.logrotate file now reads in
/etc/logrotate.d is
/home/chris/fetchmaillog {
daily
rotate 8
compress
datext
missingok
notifempty
create 0664 chris chris
sharedscripts
postrotate
/usr/local/bin/fetchmail --quit; fetchmail -v --nokeep --
nosyslog --logfile /home/chris/fetchmaillog --uidl -m procmail
endscript
}
The new fetchmaillog file was created however it was staying at 0 in
size. Running pgrep fetchmail showed it was running so is it possible
that I need a prerotate/endscript that will be written as:
prerotate
/usr/local/bin/fetchmail --quit
endscript
and only have the postrotate/endscript command to restart fetchmail
after the log is rotated?
Chris
--
Chris
KeyID 0xE372A7DA98E6705C
31.11972; -97.90167 (Elev. 1092 ft)
07:37:39 up 6 days, 16:43, 1 user, load average: 1.62, 0.75, 0.53
Ubuntu 16.04.1 LTS, kernel 4.4.0-57-generic #78-Ubuntu SMP Fri Dec 9
23:50:32 UTC 2016
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
-
Forwarded by the Webmin mailing list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-list
signature.asc
(application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlhidfUACgkQ43Kn2pjmcFxCUACbBIZYFUtnYjBM+pXJ80bLYd07 cYUAn0aN6+s2IiplBM00l8n5ulGrGx8T =P8xl -----END PGP SIGNATURE-----