Re: Auto Starting +/or Shutdown on OS X

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: smithrn(at)u(dot)washington(dot)edu
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Auto Starting +/or Shutdown on OS X
Date: 2007-07-30 22:01:11
Message-ID: FD15A160-20C0-4F9C-BA10-7F76A5E68577@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jul 30, 2007, at 16:14 , Ralph Smith wrote:

> I'm using scripts in /Library/StartupItems/PostgreSQL

I haven't used a StartupItem for PostgreSQL since launchd was
released. I haven't looked too closely at your configuration, but you
might consider using a launchd plist instead. Here's one of mine
(from /Library/LaunchDaemons/org.postgresql.postgres.v824.plist).
Note that if you use one of the plist launchd configuration editors
out there you'll probably lose the comments when you save.

Hope this helps.

Michael Glaesemann
grzm seespotcode net

<?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">
<!--
This launchd.plist file is used by the launchd process (availabie on
Mac OS X 10.4 and later) to launch and shutdown a PostgreSQL server.
The launchd.plist is used instead of a StartupItem. For detailed
descriptions
of launchd parameters and launchd, refer to to the launchd.plist,
launchd, and
launchctl manpages.

launchd.plists are commonly named in a manner similar to preference
plist files,
so for consistency (and easy identification) launchd.plists for
PostgreSQL
server instances should begin with org.postgresql.postgres. When running
multiple server instances on one machine, you may wish to distinguish
them. For
example, if one of your PostgreSQL servers is 8.0 and another 8.1,
you might
name the two launchd.plist files

org.postgresql.postgres.v80.plist
org.postgresql.postgres.v81.plist

Another alternative is to identify them by use. For example, when
running one
development server instance and a production server instance on the same
machine, you might name the two launchd.plist files

org.postgresql.postgres.dev.plist
org.postgresql.postgres.prod.plist

Note: While commments in launchd.plist files do not appear to
interfere with
launchd operation, editing and saving this file using Property List
Manager
will *not* preserve comments (including these)!

-->
<dict>
<key>Label</key>
<!-- Set the Label parameter to a unique string identifying
the job to
launchd. This is commonly set to the naem of the
launchd.plist file
without the .plist extension.
-->
<string>org.postgresql.postgres.v824</string>
<key>OnDemand</key>
<false/>
<key>Disabled</key>
<!-- Set the OnDemand parameter to <true/> to prevent the server
from
starting automatically on system start or when launched by
launchctl.
-->
<false/>
<key>ProgramArguments</key>
<!-- The elements of the ProgramArguments parameter array are
the command
line string used to start the server, exploded on white
space. No
string should contain spaces.

The first element is the absolute path to the postmaster
server
application binary, followed by the argments to be passed
to the
postmaster server application. Add, delete, and update these
parameter strings as needed for your requirements. The
example includes
setting the database data directory (PGDATA) and sets the
redirect_stderr runtime parameter.
-->
<array>
<string>/usr/local/pgsql/pgsql-8.2.4/bin/postmaster</
string>
<string>-D</string>
<string>/usr/local/pgsql/pgsql-8.2.4/data</string>
<string>-c</string>
<string>redirect_stderr=YES</string>
</array>
<key>ServiceDescription</key>
<!-- The ServiceDescription parameter is a human-readable
string to describe
the purpose of the service provided, in this case the
PostgreSQL dbms
server.
-->
<string>PostgreSQL Server v8.2.4</string>
<key>UserName</key>
<!-- Set the Username parameter string to the user who is to
owns the PostgreSQL
server process, typically "postgres".
-->
<string>postgres</string>
<key>GroupName</key>
<!-- Set the GroupName parameter to group of the user who is
to own the
PostgreSQL process, typically "postgres".
-->
<string>postgres</string>
</dict>
</plist>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Allison 2007-07-30 23:26:45 pg_dump
Previous Message Ralph Smith 2007-07-30 21:14:12 Auto Starting +/or Shutdown on OS X