Postgres launchd script suggestions

Christian Voelker C.Voelker at gmx.net
Thu Jun 7 08:19:51 PDT 2007


Hello Markus and Jyrki,

I am running PostgreSQL as built by macports since some time
with great success (currently I have a little issue on a G5
iMac, by I have to investigate that myself before screaming).
Thank you for your porting efforts, package maintainance and
fast response to updates!

With every update, I have to replace one file manually with
a slightly modified version though. I believe that my mods
would not break anybodies installation but enhance the over-
all experience in some cases. Thus, I have put together a
little patch. Please discuss or integrate in case you decide
that this is a good mod. Obviously, I myself would benefit
the most from this ;-). the file in question is:

/opt/local/etc/LaunchDaemons/org.macports.postgresql82-server/ 
postgresql82-server.wrapper

Here comes the patchfile. If the format does not fit your
needs, please tell me how to do better or point me to a
place telling how to do it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgresql82-server.wrapper.patch.unified
Type: application/octet-stream
Size: 1477 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/macports-users/attachments/20070607/12bd6388/postgresql82-server.wrapper.patch.obj
-------------- next part --------------


Some comments on the two issues I am addresing with my changes.
First, the postgres user account. The Macs I am running Postgres
on are also used interactively. The Login screen is set to list
mode. Unlike other unix accounts created for use by daemons, the
postgres account shows up in this list, which adds confusion to
other users accessing this machine. This behaviour can be sup-
pressed by setting the shell variable in the NetInfo database
to /usr/bin/false as shown with many Apple supplied software.

The drawback of denying interactive login to such user accounts
is in testing and boot scripts. A way around this is to call su
with -m option which inherits the environment from root, which
is the user account used by the invoking launchd service. I cant
see this to be harmful unless you were used to setting environ-
ment variables in another place then /etc/profile which I use for
this purpose. Please note, that setting shell to /usr/bin/false
could be done by your install scripts using niutil. This would
be the next step in sophistication not shown in my patch.


The other place of modification is a short hint to the user on
how to set the environment variable POSTGRESQL82DATA to a value
of their choice. I had to do this when I decided on my scheme for
database backup. Actually, I keep the whole macports directory
structure under /Library/Macports with fresh installs. I do this
to avoid /opt showing up in the root directory. I feel in sync
with Apples policy on places to install 3rd party software and
with macports installing interactive apps such as Abiword in a
folder called /Applications/Macports. I also keep working data
of any installed additional services such as CVS in directories
named /Library/Name_of_service to ease backup. Other users might
decide to keep such data under /Users/Shared/ or wherever.

Lastly, I like to use Console.app to read Logfiles. Console.app
comes prefconfigured with three directories in the side column,
where to look for logfiles. These three folders seem to be hard
wired, which might not be that smart from Apple, but which makes
it barely usable for Logfiles burried deep inside the directory
structure of macports. I feel users should be supported if they
like to keep their Logfiles elsewhere. The three folders in the
sidebar are (~)/Library/Logs and /var/log respectively. With the
rationale mentioned above, I keep Logfiles under /Library/Logs/.

I had to figure out myself, how to set POSTGRESQL82DATA without
modifying the wrapper provided by you myself. I feel that every-
body who tries to do so will come to this place and thus found
this the right place for a comment. i also introduced a variable
for the logging directory.

Yours, Christian



More information about the macports-users mailing list