RIGHT:[[Mac 関係覚え書き]]
Apple Developer Connection の記事
-[[Getting Started with launchd:http://developer.apple.com/macosx/launchd.html]]
----
*Launchd のスクリプト作成例1 [#e20dbd18]
Launchd を利用してログイン時に Symantec AntiVirus
ウイルス定義ファイルを更新する.
-1 /etc/symliveupdate.sh スクリプトを作成.
内容は,
#!/bin/sh
LANG=C; export LANG
DATE=`date +%s`
UPDATE_INTERVAL=7
# 次の 2行は実際には 1行
UPDATED=`find /Library/Application\ Support/Symantec/LiveUpdate/
-name liveupdt.log -a -mtime -${UPDATE_INTERVAL} | wc -l`
if [ ${UPDATED} -ne "0" ]
then
exit 0
fi
# 次の 2行は実際には 1行
/Library/Application\ Support/Norton\ Solutions\ Support/LiveUpdate/
LiveUpdate.app/Contents/MacOS/LiveUpdate -update LUal \
-liveupdatequiet YES -liveupdateautoquit YES > /dev/null 2>&1
-2 /Library/LaunchAgents/SymLiveUpdate.plist を作成
この部分は Lingon http://lingon.sourceforge.net/ を利用して作成
するのが簡単.
Lingon の使い方は,実際に使ってみれば説明しなくても何となく分かると思う.
内容は,
<?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>SymLiveUpdate</string>
<key>ProgramArguments</key>
<array>
<string>/etc/symliveupdate.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>