hi all,
after much help/education elsewhere re: building a launchd .plist for apache2,
etc., i'm on to postgresql ...
my 'original' and fully functional StartupItem string(s) for pgsql is(are):
cd /var/Settings/PgSQL/
sudo -u pgsuser
sh -c "nohup /usr/local/pgsql/bin/postmaster -d 5 -n -i -h 10.0.0.6 -D
/var/Data/PgSQL -c config_file=/var/Settings/PgSQL/postgresql.conf </dev/null
>>/var/Logs/postgresql_stderror.log &"
never a problem with it ... and any/all attempts to use/launch are correctly
AND informatively/verbosely logged in BOTH my system.log & postgresql_stderror.
now, on to a launchd .plist ...
i've googled for scripts online (e.g., here: N Tulach,
<http://archives.postgresql.org/pgsql-ports/2005-05/msg00005.php>), and with a
few mods am using:
==========================================================
<?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>Disabled</key> <false/>
<key>Debug</key> <true/>
<key>OnDemand</key> <false/>
<key>Label</key> <string>org.postgresql.postmaster</string>
<key>ServiceDescription</key> <string>PostgreSQL 8 Server</string>
<key>UserName</key> <string>pgsuser</string>
<key>GroupName</key> <string>pgsuser</string>
<key>WorkingDirectory</key> <string>/var/Settings/PgSQL</string>
<key>StandardOutPath</key>
<string>/var/Logs/postgresql_stderror.log</string>
<key>StandardErrorPath</key>
<string>/var/Logs/postgresql_stderror.log</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/pgsql/bin/postmaster</string>
<string>-d</string> <string>5</string>
<string>-n</string>
<string>-i</string>
<string>-h</string> <string>10.0.0.6</string>
<string>-D</string> <string>/var/Data/PgSQL</string>
<string>-c</string>
<string>config_file=/var/Settings/PgSQL/postgresql.conf</string>
<string>-c</string>
<string>log_filename=/var/Logs/postgresql_stderror.log</string>
</array>
</dict>
</plist>
==========================================================
on 'launchctl load', my syslog shows only (again!):
Jul 26 09:21:54 devuser launchd: org.postgresql.postmaster: exited with
exit code: 1
Jul 26 09:21:54 devuser launchd: org.postgresql.postmaster: respawning too
quickly! throttling
Jul 26 09:21:54 devuser launchd: org.postgresql.postmaster: 9 more failures
without living at least 60 seconds will cause job removal
Jul 26 09:21:54 devuser launchd: org.postgresql.postmaster: will restart in
10 seconds
with apache, these errors were elim'd by a combo of:
adding "-D FOREGROUND"
removing UserName & GroupName
with PostgreSQL, however (from
<http://www.postgresql.org/docs/current/static/postmaster-start.html>):
"Thus, the simplest way to start the server is:
$ postmaster -D /usr/local/pgsql/data
which will leave the server running in the foreground. This must be done
while logged into the PostgreSQL user account"
which would seem to indicate that:
(a) postmaster DEFAULTS to the foreground, and hence, does NOT need a flag to
do so
(b) postmaster must be run as the postgresql user/group
QUESTIONS:
any ideas why launchd is 'acting up' w.r.t PostgreSQL? and, what to do abt it?
cheers,
richard