Re: restart server on Lion - Mailing list pgsql-general

From A.M.
Subject Re: restart server on Lion
Date
Msg-id 4A644E00-B537-4E67-818B-BB7A128436C0@themactionfaction.com
Whole thread Raw
In response to restart server on Lion  (Scott Frankel <frankel@circlesfx.com>)
Responses Re: restart server on Lion  (Scott Frankel <frankel@circlesfx.com>)
Re: restart server on Lion  (Scott Frankel <frankel@circlesfx.com>)
Re: restart server on Lion  (Scott Frankel <frankel@circlesfx.com>)
Re: restart server on Lion  (Scott Frankel <frankel@circlesfx.com>)
List pgsql-general
On Jan 30, 2012, at 2:40 PM, Scott Frankel wrote:

>
> Hi all,
>
> What's the best/correct way to cause the PostgreSQL server to startup automatically when rebooting on OSX 10.7 Lion?

>
> I'm using a macports install of postgres 8.4 and went through a couple grueling days, sudo'd up to my eyeballs, to
restorethe postgres user and have a working installation. 
>
> To start the service, I'm currently invoking this on the cmd-line:
>
>     sudo su postgres -c "/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/postgresql84/defaultdb -l
/opt/local/var/postgresql84/defaultdb/data/logfile.txtstart" 
>
> That's pretty cumbersome for each reboot.  I've also seen references to manually invoking this on the cmd-line:
>
>     sudo serveradmin start postgres
>
> But that yields "postgres:error = "CANNOT_LOAD_BUNDLE_ERR"
>
> Is there an /etc or OSX-specific solution people are using for restarts?  My PG 8.3 server restarted automagically on
OSX10.5.  While I don't recall setting up anything specifically to make that happen, memory fades... 

MacPorts includes a launchd plist to handle this. (Perhaps "launchd" is the keyword you need to search.)

/Library/LaunchDaemons/org.macports.postgresql90-server.plist (for PostgreSQL 9.0, of course)
http://od-eon.com/blogs/calvin/os-x-lion-postgresql/

You can adjust the script to your liking.

Cheers,
M

pgsql-general by date:

Previous
From: Scott Frankel
Date:
Subject: restart server on Lion
Next
From: Heine Ferreira
Date:
Subject: Postgresql logging questions