Lists: | pgsql-hackers |
---|
From: | Diogo Santos <d(dot)santos(at)tomorrow-options(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Auto Start second postgres 8.3.15-1 instance MAC OS X |
Date: | 2011-06-20 10:14:55 |
Message-ID: | BANLkTi=HeErVSTAgoFFeV+NeC0ds=PL=tw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi, I'm used to work with PostgreSQL on Windows but now I've moved to OS X
and I'm having problems to create a service to auto start a new server
(instance) of PostgreSQL.
Firstly I used the PostgreSQL installer to create the first server and the
postgres user, then I used initdb to create another server and until this
step, everything turned fine.
After that, I created a folder on StartupItems with StartupParameters and
the other script.
Here are the contents of the two files:
#walkinsense-pgsql
#!/bin/sh
. /etc/rc.common
# Postgres Plus Service script for OS/X
StartService ()
{
ConsoleMessage "Starting Walkinsense PostgreSQL"
su - postgres -c "/Library/PostgreSQL/8.3/bin/pg_ctl -D
/Users/iMac1/Library/Teste/data -l
/Library/Walkinsense/data/pg_log/startup.log -o \"-p 5440\" start"
if [ -e "/Library/Walkinsense/data/postmaster.pid" ]
then
ConsoleMessage "PostgreSQL 8.3 started successfully"
else
ConsoleMessage "PostgreSQL 8.3 did not start in a timely fashion, please see
/Library/Walkinsense/data/pg_log/startup.log for details"
fi
}
StopService()
{
ConsoleMessage "Stopping PostgreSQL 8.3"
su - postgres -c "/Library/PostgreSQL/8.3/bin/pg_ctl stop -m fast -w -D
/Users/iMac1/Library/Teste/data"
}
RestartService ()
{
StopService
sleep 2
StartService
}
RunService "$1"
#SetupParameters
{
Description = "Walkinsense-pgsql";
Provides = ("walkinsense-pgsql");
Requires = ("Resolver");
Preference = "Late";
Messages =
{
start = "Starting Walkinsense PostgreSQL";
stop = "Stopping Walkinsense PostgreSQL";
};
}
Then, I changed the directory permissions doing "sudo chown root:wheel
/Library/StartupItems/walkinsense-pgsql" at the terminal.
When I do "sudo SystemStarter start walkinsense-pgsql" at the terminal, it
gives back the message:
Starting Walkinsense PostgreSQL
pg_ctl: could not open PID file
"/Users/iMac1/Library/Teste/data/postmaster.pid": Permission denied
As you see, the server doesn't start.
I hope I explained it right.
Thanks!!
Diogo
From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Diogo Santos <d(dot)santos(at)tomorrow-options(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Auto Start second postgres 8.3.15-1 instance MAC OS X |
Date: | 2011-06-22 02:09:48 |
Message-ID: | BANLkTikEZz=9m9XO7o4eXYhEK-EKB9_pog@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Jun 20, 2011 at 6:14 AM, Diogo Santos
<d(dot)santos(at)tomorrow-options(dot)com> wrote:
> Hi, I'm used to work with PostgreSQL on Windows but now I've moved to OS X
> and I'm having problems to create a service to auto start a new server
> (instance) of PostgreSQL.
> Firstly I used the PostgreSQL installer to create the first server and the
> postgres user, then I used initdb to create another server and until this
> step, everything turned fine.
> After that, I created a folder on StartupItems with StartupParameters and
> the other script.
> Here are the contents of the two files:
I have no idea how to troubleshoot this, but you might want to take a
loop at the contents of contrib/start-scripts/osx.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company