Hi guys. I'm trying to get PostgreSQL to start up every time my Mac mini does, but that requires Terminal access.
Some guy created a utility to do this (which
some other guy fixed), and I've ended up with this relevant excerpt in a StartupItem document:
StartService ()
{
if [ "${POSTGRES:=-YES-}" = "-YES-" ]; then
ConsoleMessage "Starting PostgreSQL database server"
su - postgres -c '/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l /usr/local/pgsql/logfile -o -i'
fi
}
However, it doesn't work, and when I test it in the Terminal (sudo /Library/StartupItems/PostgreSQL/PostgreSQL start) I get the error /usr/local/pgsql/logfile - permission denied.
The basic parameters of this are: I am logging in as one user, let's say "thejoshu", and the owner of these folders (/usr/local/postgres/[...]) is another user, "postgres." By hand, in the Terminal, I use
Apple's recommendation to start PostgreSQL:
su -l postgres
[password]
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
I expect the problem is that there's no place in this code for me to provide postgres's password before starting postgreSQL?
Any ideas? Thanks!