AFP548 Changing the world one server at a time.

Fetchmailrc launchd configuration

Home › Forums › OS X Server and Client Discussion › Questions and Answers › Fetchmailrc launchd configuration

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #377422
    atma
    Participant

    Greetings,

    I want to make launchd act like cron for my fetchmail and hence I’m trying to write my first launchd xml script. Although I’ve read a lot, apparently the task is proven a bit more difficult that I imagined.
    Given the fact that as a user I can run fetchmail through the command line with issues and get all my emails to $HOME/Mail/ for mutt to see, I decided to create a launchd xml startup file and place it on $HOME/Library/LaunchDaemons/ .

    So here is my script



    Disabled

    KeepAlive

    Label
    org.macports.fetchmail
    Program
    /usr/bin/fetchmail
    ProgramArguments

    –fetchmailrc=/Users/atma/.fetchmailrc
    –pidfile=/Users/atma/.fetchmail/fetchmail.pid
    –nodetach

    RunAtLoad

    This is the last xml file I’ve made. The prior one, which made more sense to me was with time interval. But it did not work either. All the files I create don’t work and when I load them I get the same string of errors:

    launchd[1123]: org.macports.fetchmail: exited with exit code: 1
    launchd[1123]: org.macports.fetchmail: 9 more failures without living at least 60 seconds will cause job removal

    and a weird bonjour error that I can’t replicate right now and I can’t find on syslog. Since I plan to write a few more launchd scripts… Can someone explain what am I missing here?

    Thanks in advance,

    regards

    #377427
    robinson
    Participant

    In my case I did it with 2 files. First I have /etc/fetchmailrc with

    poll mail.yourprovider.com proto pop3
    user user@yourprovider.com password secret sslproto '' is user here

    and then the /Library/LaunchDaemons/info.fetchmail.launchd.plist with

    info.fetchmail.launchd.plist
    sh-3.2# vim info.fetchmail.launchd.plist 
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>Disabled</key>
            <false/>
            <key>Label</key>
            <string>info.fetchmail.launchd</string>
            <key>ProgramArguments</key>
            <array>
                    <string>fetchmail</string>
                    <string>-f</string>
                    <string>/etc/fetchmailrc</string>
                    <string>-d</string>
                    <string>300</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
            <key>UserName</key>
            <string>admin</string>
    </dict>
    </plist>

    It’s important that the UserName (in my case “admin”) is the owner of /etc/fetchmailrc

    #377428
    Violet
    Participant

    Hi Robinson….

    Can you give me a bit more info how you achieved this.??

    – File permissions…
    – Debugging…..

    Any help would be great.

    #377457
    robinson
    Participant

    I used Lingon http://sourceforge.net/projects/lingon/files/ for create the plist file. I cannot give you any advice because I don’t know much more about this by myself. Sorry.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.