Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here's a puzzler: I have a .plist in /Library/LaunchDaemons which is set to run at 3:01 am every day, but which does not run. However (this is the puzzling part) when it is started with launchctl everything works fine:

sudo launchctl start com.my.daemon

Additionally (this is even more puzzling) if you unload the daemon, change StartCalendarInterval to be several minutes in the future, then re-load the daemon, everything also works fine -- at the indicated time a few minutes in the future the daemon executes the script.

So basically the only way that it won't work is how I actually want it to work, which is to start the next day at 3:01 a.m.

For reference, here's what the script looks like. It's running on Tiger 10.4.11:

<?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>Label</key>
        <string>com.my.daemon</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/bin/open</string>
                <string>/Users/joe/import/do_import.fp7</string>
        </array>
        <key>StandardErrorPath</key>
        <string>/Library/Logs/my_err.log</string>
        <key>StandardOutPath</key>
        <string>/Library/Logs/my_out.log</string>
        <key>StartCalendarInterval</key>
        <dict>
                <key>Hour</key>
                <integer>3</integer>
                <key>Minute</key>
                <integer>1</integer>
        </dict>
        <key>UserName</key>
        <string>joe</string>
        <key>WorkingDirectory</key>
        <string>/Users/joe/import/</string>
</dict>
</plist>

You will want to know what the logs say. Because I was screwing around with this a lot yesterday, and in the course of copying and pasting may have inadvertantly loaded other daemons by the same name, I'm not positive this is really the log of the daemon in question. Still, this is what was in the error log. (However, keep in mind that when the daemon gets launched either via 'launchctl start' or else by making StartCalendarInterval a couple of minutes in the future, the logs are empty.)

2012-01-21 03:00:53.199 open[816] CFLog (0): CFMessagePort: bootstrap_register(): failed 1100 (0x44c), port = 0x2203, name = 'Processes-0.151912449' See /usr/include/servers/bootstrap_defs.h for the error codes.

2012-01-21 03:00:53.208 open[816] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (Processes-0.151912449) CFMessagePortCreateLocal failed (name = Processes-0.151912449 error = 0)

2012-01-21 03:01:00.100 open[818] CFLog (0): CFMessagePort: bootstrap_register(): failed 1100 (0x44c), port = 0x2203, name = 'Processes-0.152043521' See /usr/include/servers/bootstrap_defs.h for the error codes.

2012-01-21 03:01:00.101 open[818] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (Processes-0.152043521) CFMessagePortCreateLocal failed (name = Processes-.152043521 error = 0)

Help is much appreciated, not just because I need this to work, but because the puzzle is driving me crazy.

share|improve this question
    
What OS are you using? (I doubt it will matter, but it might be important) –  voretaq7 Jan 22 '12 at 2:10
    
Mac OS Tiger, 10.4.11 –  shanusmagnus Jan 22 '12 at 5:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.