Weblog | Techlog | MySpace

LaunchDaemons on MacOSX

| | Comment(2) | Trackback(0)

On MacOSX 10.4.x or greater version, you can not use cron daemon to execute scheduled commands.
You have to use launchd.

Add plist under /System/Library/LaunchDaemons.

First string belongs to the key "Label" is unique ID of Daemon process.

The array of "Program Arguments" is the command you want to execute.

And "StartCalendarInterval" is date and time of the scheduled command.

After setting plist, enter the command to load plist.

# launchctl load -w NAMEOFPLIST

And check if the plist was surely loaded,

# launchctl list

Unload plist,

#launcctl unload -w NAMEOFPLIST


Here is a sample plist.
----------------------------------------------------

<?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>named0309</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>1</integer>
<key>ProgramArguments</key>
<array>
<string>/Users/Applications/YOURCOMMAND</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>37</integer>
<key>Hour</key>
<integer>14</integer>
<key>Day</key>
<integer>12</integer>
<key>Month</key>
<integer>4</integer>
</dict>
</dict>
</plist>

Category

Trackback(0)

Trackbacking Blog List : LaunchDaemons on MacOSX

Trackback URL: http://mentalposition.com/mppweblog/mt-tb.cgi/154

Comment(2)

ゴウユウ :

Mac OS X Server で cron が動かなくて往生こいたことがあったけど、launchd いじらなきゃならならなかったのか。

POLO :

そうそう。
以前、自分もはまって、cronまわりが変更されたことはわかったものの、面倒だったからそのままにしてたんだけど、今回は、対応できない時間帯にDNS更新があったので、調べてみました。

Comment


Type the characters you see in the picture above.

About this blog

This page was entried by POLO March 8, 2008 11:41 PM

Previous Entry is

Note:vqadmin setting

Next Entry is

Adobe Photoshop Express Beta

Recent entries are in

Index Page.

Past entries are in

Archive page

RSS RSS