Blogging Roller
Dave Johnson on social software, open source and Java
Dave Johnson on social software, open source and Java
I followed the PostgreSQL installation instructions on Apple's site and got PostgreSQL up and running in no time. To make PostgreSQL start when MacOS starts, I had to do a little more work. I added a startup item as described in James Duncan Davidson's Running Mac OS X Panther. First, I created a startup item directory and used vi to create a parameters file:
root# mkdir -p /Library/StartupItems/PostgreSQL root# cd /Library/StartupItems/PostgresSQL root# vi StartupParameters.plist
Next, I guessed that PostgreSQL requires Directory Services and uses Disks and came up with this StartupParameters.plist file:
{
Description = "PostgreSQL Server";
Provides = ("PostgreSQL");
Requires = ("DirectoryServices");
Uses = ("Disks");
OrderPreference = "None";
}
Finally, I wrote a startup script to start, restart, and stop PostgreSQL:
#!/bin/sh
. /etc/rc.common
StartService() {
echo "Starting PostgreSQL"
sudo -u postgres /usr/local/pgsql/bin/postmaster -i -D /var/postgres/rollerdb &
}
RestartService() {
echo "Restarting PostgreSQL"
sudo -u postgres /usr/local/pgsql/bin/pg_ctl -D /var/postgres/rollerdb stop
sudo -u postgres /usr/local/pgsql/bin/postmaster -i -D /var/postgres/rollerdb &
}
StopService() {
echo "Stopping PostgreSQL"
sudo -u postgres /usr/local/pgsql/bin/pg_ctl -D /var/postgres/rollerdb stop
}
RunService "$1"
Once I was done with that I tested starting, restarting, and stopping PostgreSQL using the SystemStarter command. Once the script worked, I rebooted and found that PostgreSQL did indeed start on startup. It works, but I wonder, is this the best way to configure service for Mac OS X? Davidson's book menioned xinetd and mach bootstrap servers, but says that the SystemStarter is the way to go for now.
Tags: Mac
Posted by Jon Mountjoy on May 26, 2004 at 03:15 AM EDT #
Posted by Robert Sfeir on May 26, 2004 at 07:49 AM EDT #
Posted by arturo on May 26, 2004 at 10:59 AM EDT #
Posted by Ted on May 26, 2004 at 07:40 PM EDT #
Posted by Ted on May 27, 2004 at 01:13 PM EDT #