From: Chris <cpo...@em...> - 2017-02-16 13:45:29
|
On Sun, 2017-02-12 at 11:03 -0600, Chris wrote: > On Sun, 2017-02-12 at 16:25 +0100, Matthias Andree wrote: > > > > Am 12.02.2017 um 15:56 schrieb Chris: > > > > > > > > > postrotate > > > /usr/local/bin/fetchmail --quit > > > /usr/local/bin/fetchmail -v --nokeep --nosyslog --logfile > > > /home/chris/fetchmaillog --uidl -m procmail > > > endscript > > > [...] > > > running postrotate script > > > fetchmail: background fetchmail at 3786 killed. > > > fetchmail: can't accept options while a background fetchmail is > > > running. > > > > > > > > > > > I don't understand why it worked the first time but not the 2nd > > > as > > > nothing was changed in between. > > > > Hi Chris, > > > > Looks like a race between the three instances of fetchmail > > involved: > > > > 1. you have 3786 > > 2. postrotate starts fetchmail -q, which just signals 3786 to exit, > > but > > does not wait for its exit (because it's not its child that > > wouldn't > > be > > 100% safe anyhow) > > 3. postrotate immediately starts a new fetchmail, which stumbles > > over > > the still existing instance that's still cleaning up. > > > > It'd probably be good to wait until the prior instance has really > > quit > > before starting the next one, like so (adjust the pid file's path): > > > > /usr/local/bin/fetchmail --quit > > > > while [ -e /path/to/fetchmail.pid ] ; do sleep 1 ; done > > > > /usr/local/bin/fetchmail -v --nokeep --nosyslog --logfile > > /home/chris/fetchmaillog --uidl -m procmail > > > > > > and possibly adding a counter so it does not wait too long or > > otherwise > > use SIGKILL to get rid of the old instance. > > > > Neither will be 100% bullet-proof unless you defer to a service > > supervisor such as runit, upstart, systemd, or thereabouts, and > > just > > request a fetchmail restart from such a supervisor in your > > postrotate > > script. > > > > HTH > > Matthias > > > Thanks Matthias, I'm sure it will. I'll make the changes and give it > some test runs until I get it right. Appreciate the assistance. > Adding that one line to the script got it to run perfectly Matthias, thanks so much for the help Chris -- Chris KeyID 0xE372A7DA98E6705C 31.11972; -97.90167 (Elev. 1092 ft) 07:43:27 up 12 days, 23:41, 2 users, load average: 2.88, 1.87, 1.11 Description: Ubuntu 16.04.2 LTS, kernel 4.4.0-62-generic |