From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Israel Brewster <israel(at)ravnalaska(dot)net> |
Cc: | Jerry Levan <jerry(dot)levan(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Yosemite (OSX 10.0) problems with Postgresql |
Date: | 2014-10-20 16:40:43 |
Message-ID: | 1239.1413823243@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Israel Brewster <israel(at)ravnalaska(dot)net> writes:
> On Oct 20, 2014, at 4:26 AM, Jerry Levan <jerry(dot)levan(at)gmail(dot)com> wrote:
>> 2) SystemStarter is no longer available. Gulp I am not a very good plist creator.
>> Is there a fairly generic plist I can edit to specify my locations of the
>> software bits so I can have postgresql started at boot time?
> I'm not familiar with SystemStarter, but here is the plist file that
> I've been using on several of my machines to start my own copy of
> postgres. Modified from the copy that comes with apple's server.app.
FWIW, I ran into the no-more-SystemStarter problem over the weekend on a
machine that I run a secondary DNS server on. It turns out that Apple's
recipe for this sort of thing omits a very important consideration:
during boot, launchd will happily launch the specified program before
any networking has come up. If you check after rebooting, you'll probably
find that your postmaster has started but has only bound a socket to
127.0.0.1, because no external TCP interfaces were alive when it looked.
Maybe this is OK for your usage of Postgres, but I was definitely not
happy about the machine not offering any DNS service externally :-(
After some googling I ended up with the following pretty hacky solution:
interpose a shell script that waits for networking to be up.
$ more /Library/LaunchDaemons/mydns.plist
<?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>Label</key>
<string>mydns</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/usr/local/sbin/mydnsctl.sh</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
$ more /usr/local/sbin/mydnsctl.sh
#!/bin/sh
# fetch the Apple-provided network check function
# also sets a sane PATH
. /etc/rc.common
CheckForNetwork
while [ x"$NETWORKUP" != x"-YES-" ]
do
sleep 1
NETWORKUP=""
CheckForNetwork
done
# use -f flag because launchd doesn't want daemons to fork
exec /usr/local/sbin/named -f
After looking at CheckForNetwork() I don't have a lot of confidence
that it would work if you have multiple network interfaces, but at
least for the bog standard one-NIC situation this seems to work.
The recipe we have in contrib/start-scripts/osx/ has been obsolete
for awhile, but it's well and truly broken for Yosemite. Anyone care
to submit a patch to replace that example with something launchd-based?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Day, David | 2014-10-20 17:36:58 | problem in to_char( ) ? |
Previous Message | Wells Oliver | 2014-10-20 16:36:05 | Re: Yosemite (OSX 10.0) problems with Postgresql |