Re: Yosemite (OSX 10.0) problems with Postgresql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Yosemite (OSX 10.0) problems with Postgresql
Дата
Msg-id 1239.1413823243@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Yosemite (OSX 10.0) problems with Postgresql  (Israel Brewster <israel@ravnalaska.net>)
Список pgsql-general
Israel Brewster <israel@ravnalaska.net> writes:
> On Oct 20, 2014, at 4:26 AM, Jerry Levan <jerry.levan@gmail.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


В списке pgsql-general по дате отправления:

Предыдущее
От: Wells Oliver
Дата:
Сообщение: Re: Yosemite (OSX 10.0) problems with Postgresql
Следующее
От: "Day, David"
Дата:
Сообщение: problem in to_char( ) ?