pg.ddx.io  pgsql-ports@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: OpenMacNews <OpenMacNews@speakeasy.net>
To: pgsql-ports@postgresql.org
Cc: ntulach@mac.com
Subject: starting PgSQL w/ launchd on OSX 10.4.2
Date: Tue, 26 Jul 2005 10:05:52 -0700
Message-ID: <DACBBDA517C947EEB4FAF0F6@tiedgar> (raw)

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



Message-ID: <DACBBDA517C947EEB4FAF0F6@tiedgar>
Permalink:  ../DACBBDA517C947EEB4FAF0F6@tiedgar/
Also on:    postgresql.org/message-id/DACBBDA517C947EEB4FAF0F6@tiedgar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-ports@postgresql.org
  Cc: OpenMacNews@speakeasy.net, ntulach@mac.com
  Subject: Re: starting PgSQL w/ launchd on OSX 10.4.2
  In-Reply-To: <DACBBDA517C947EEB4FAF0F6@tiedgar>
  References: <DACBBDA517C947EEB4FAF0F6@tiedgar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox