Auto Start second postgresql instance MAC OS X - Mailing list pgsql-general

From Diogo Santos
Subject Auto Start second postgresql instance MAC OS X
Date
Msg-id BANLkTi=t=9DTA7r6=DxSmttuA3j7NoYdKQ@mail.gmail.com
Whole thread Raw
List pgsql-general
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";
  };
}

I appreciate your help because I'm wasting a lot of time with this and I think you could help me easily.
Thanks!!

Diogo

pgsql-general by date:

Previous
From: "David Johnston"
Date:
Subject: Re: ncoding "Table Name" and "Filed Name"
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Issues with generate_series using integer boundaries