Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Auto-launch Fetchmail during boot System 10.4
Tiger only hintThe one thing I missed when I switched to 10.4 was Fetchmail -- I use it to pull my email from various places, and it always fired right up when I booted my computer. With the release of 10.4, Apple instituted some under-the-hood changes to the way programs auto-launch at reboot, and it's taken me until now to figure out how to run Fetchmail automatically at boot.

To auto-load Fetchmail at boot, copy the text below and paste it into a file called fetchmail.plist. The plist I use loads .fetchmailrc from /etc/mail; change this if you use a different location. Place the file in /Library/LaunchDaemons. Set permissions to 644, and set the owner to root:wheel.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>GroupName</key>
    <string>wheel</string>
    <key>Label</key>
    <string>fetchmail</string>
    <key>OnDemand</key>
    <false/>
    <key>Program</key>
    <string>/usr/bin/fetchmail</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/fetchmail</string>
        <string>-f</string>
        <string>/etc/mail/.fetchmailrc</string>
        <string>-L</string>
        <string>/var/log/mail.log</string>
        <string>-s</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
     <key>UserName</key>
     <string>root</string>
</dict>
</plist>
[robg adds: I haven't tested this one. Please note that I broke the !DOCTYPE line into two lines, for a narrower display. Enter it as one with a space replacing the line break.]
    •    
  • Currently 2.00 / 5
  You rated: 3 / 5 (3 votes cast)
 
[8,334 views]  

10.4: Auto-launch Fetchmail during boot | 4 comments | Create New Account
Click here to return to the '10.4: Auto-launch Fetchmail during boot' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Auto-launch Fetchmail during boot
Authored by: Gigacorpse on Jun 29, '05 01:20:51PM

You could have created a crontab for your user and put "@reboot" at the beginning of the line you want to run Fetchmail. Fetchmail would then launch when you boot. This is a Vixie Cron feature, which comes with Tiger and Panther.



[ Reply to This | # ]
10.4: Auto-launch Fetchmail during boot
Authored by: geoffsaulnier on Sep 30, '05 08:15:52AM

If you daemonize your fetchmail, as I do, this will fall over as soon as fetchmail starts up.

To get around that, create a tiny script that does a sleep 5 before it runs fetchmail and launch that from the plist instead.

G.

---
___<br>
Geoff Saulnier - Mac, *NIX, perl, hack!!



[ Reply to This | # ]
10.4: Auto-launch Fetchmail during boot
Authored by: geoffsaulnier on Sep 30, '05 08:26:52AM

Actually, rereading the doc at http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/index.html
I see that 5 seconds won't do it. Do a sleep 11 instead.
G.


---
___<br>
Geoff Saulnier - Mac, *NIX, perl, hack!!



[ Reply to This | # ]
10.4: Auto-launch Fetchmail during boot
Authored by: stephane.lux on Dec 30, '05 07:12:40AM

Fetchmail is running very slow on my mac mini. It takes about 1-2 minutes, to connect to a pop3 server. On a linux server in the same network in only takes about 2 seconds. What can I do?



[ Reply to This | # ]