daemondo with postgresql83-server

Darren Weber dweber at macports.org
Fri Oct 17 14:31:18 PDT 2008


I'm playing with a sandbox version of postgresql83-server and it contains
the following startup config:

############################################
set libdir      ${prefix}/lib/postgresql83
set logdir      ${prefix}/var/log/postgresql83
set dbdir       ${prefix}/var/db/postgresql83/defaultdb
set dbpid       ${dbdir}/postmaster.pid
set dbuser      postgres
set dbgrp       postgres

startupitem.create      yes
startupitem.name        ${name}
startupitem.logfile     ${logdir}/postgres.log
startupitem.logevents   yes
startupitem.init        "PGCTL=${libdir}/bin/pg_ctl"
startupitem.start   \
    "su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQL83DATA:=${dbdir}} start -w
-l ${logdir}/postgres.log -o \\\"-i -l\\\"\""
startupitem.stop    \
    "su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQL83DATA:=${dbdir}} stop -s
-m fast\""
startupitem.restart \
    "su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQL83DATA:=${dbdir}} restart
-w -s -m fast\""
startupitem.pidfile     clean ${dbpid}
############################################

Is it possible to use startupitem.execute for postgresql83?  The script
wrapper simply contains the pg_ctl commands listed above, maybe daemondo
could call pg_ctl directly?  Maybe daemondo could be configured to replace
pg_ctl and call the postmaster directly?


The pid file (/opt/local/var/db/postgresql83/defaultdb/postmaster.pid) is
only available to user postgres:

-rw-------  1 500  postgres  67 Oct 13 20:12
/opt/local/var/db/postgresql83/defaultdb/postmaster.pid

It contains (pid in bold):

[ dweber at XXX ~ ]$ sudo cat
/opt/local/var/db/postgresql83/defaultdb/postmaster.pid
88055
/opt/local/var/db/postgresql83/defaultdb
  5432001    131072

Can daemondo read AND parse this file to get the pid and use it to monitor
the server?  This is the relevant entries on the system from `ps aux | grep
post` (while running the server and pgAmin3 with one connection):

500      88060   0.3  0.0    84776    400   ??  Ss   Mon08PM   0:15.39
postgres: stats collector process










500      86574   0.0  0.0    87992   4208   ??  Ss    2:05PM   0:00.13
postgres: postgres postgres 127.0.0.1(52101) idle










500      88059   0.0  0.0    86920    584   ??  Ss   Mon08PM   0:07.85
postgres: autovacuum launcher process










500      88058   0.0  0.0    86856    436   ??  Ss   Mon08PM   0:13.90
postgres: wal writer process










500      88057   0.0  0.0    86856    752   ??  Ss   Mon08PM   0:18.96
postgres: writer process











root     88044   0.0  0.0    75440    772   ??  Ss   Mon08PM   0:00.01
/opt/local/bin/daemondo --label=postgresql83-server --start-cmd
/opt/local/etc/LaunchDaemons/org.macports.postgresql83-server/postgresql83-server.wrapper
start ; --stop-cmd
/opt/local/etc/LaunchDaemons/org.macports.postgresql83-server/postgresql83-server.wrapper
stop ; --restart-cmd
/opt/local/etc/LaunchDaemons/org.macports.postgresql83-server/postgresql83-server.wrapper
restart ; --verbosity=1 --pid=fileauto --pidfile
/opt/local/var/db/postgresql83/defaultdb/postmaster.pid

daemon     359   0.0  0.0    77476    308   ??  S    Fri04PM   0:00.00
postgres: stats collector process

  daemon     357   0.0  0.0    78464    228   ??  S    Fri04PM   0:00.00
postgres: stats buffer process

 daemon     356   0.0  0.0    78908    960   ??  S    Fri04PM   0:00.99
/System/Library/CoreServices/RemoteManagement/rmdb.bundle/bin/postmaster -D
/var/db/RemoteManagement/RMDB/rmdb.data
500      86580   0.0  0.0    87480   3700   ??  Ss    2:07PM   0:00.01
postgres: postgres test 127.0.0.1(52109) idle






Note the pid file contains a reference to this process:
500      88055   0.0  0.0    86856   2384 s000  S    Mon08PM   0:05.13
/opt/local/lib/postgresql83/bin/postgres -D
/opt/local/var/db/postgresql83/defaultdb

Also note that this process seems to spawn several helpers, incl:
500      88060   0.3  0.0    84776    400   ??  Ss   Mon08PM   0:15.39
postgres: stats collector process
500      88059   0.0  0.0    86920    584   ??  Ss   Mon08PM   0:07.85
postgres: autovacuum launcher process
500      88058   0.0  0.0    86856    436   ??  Ss   Mon08PM   0:13.90
postgres: wal writer process
500      88057   0.0  0.0    86856    752   ??  Ss   Mon08PM   0:18.96
postgres: writer process

I could really appreciate some advice about how daemondo parses a pid file
and whether to modify this startupitem section of the port.  Also appreciate
updated clarification of daemondo vs. launchd (an old email thread on this
from late 2007 was helpful [daemondo defeats purpose of launchd?], maybe
more so than the guide pages that resulted from that thread).

Thanks, Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-users/attachments/20081017/21bda8ca/attachment.html 


More information about the macports-users mailing list