ch.6の日記: launchd の使い方
PostgreSQL を 8.1.1 にバージョンアップしたついでに、StartupItems で設定をするのではなく、launchd を使って起動するように設定した。というかそのつもりだったんだけど、なんかうまくいかない。実際には google で見つけてきたどこかのWebを参考に(ってほとんどそのまま)、/Library/LaunchDaemons/org.postgresql.PostgreSQL.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>GroupName</key>
<string>staff</string>
<key>Label</key>
<string>org.postgresql.PostgreSQL</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/pgsql/bin/pg_ctl</string>
<string>-D</string>
<string>/usr/local/pgsql/data</string>
<string>-l</string>
<string>/usr/local/pgsql/data/server.log</string>
<string>start</string>
</array>
<key>ServiceDescription</key>
<string>PostgreSQL Server</string>
<key>UserName</key>
<string>postgres</string>
</dict>
</plist>
動かないと仕方がないので前の方法に戻したんだけどすっきりしないなぁ。
/var/log/system.log には、
Dec 30 01:35:52 alumig4 launchd: org.postgresql.PostgreSQL: exited with exit code: 1
Dec 30 01:35:52 alumig4 launchd: org.postgresql.PostgreSQL: respawning too quickly! throttling
Dec 30 01:35:52 alumig4 launchd: org.postgresql.PostgreSQL: 9 more failures without living at least 60 seconds will cause job removal
Dec 30 01:35:52 alumig4 launchd: org.postgresql.PostgreSQL: will restart in 10 seconds
Dec 30 01:36:02 alumig4 launchd: org.postgresql.PostgreSQL: exited with exit code: 1
Dec 30 01:36:02 alumig4 launchd: org.postgresql.PostgreSQL: respawning too quickly! throttling
みたいなのが10回分続く。
launchd の使い方 More ログイン