11/13/2007

Auto start PostgreSQL when Linux boots (Ubuntu)



*as root*:
- Configure the PostgreSQL SysV Script. This script is useful for
starting, stopping, and checking the status of PostgreSQL.

# cd /usr/local/src/postgresql-7.x
# cp contrib/start-scripts/linux /etc/init.d/postgres
# chmod 755 /etc/init.d/postgresql
.... then edit the file to specify the data directory, etc. and sets the
environment variabes (PGDATA etc). The file is well documented. If you
installed Postgres manually, it should have the correct values already set.

- To have PostgreSQL start automatically when the computer boots add
symbolic links from the correct /etc/rc*.d/ directories to
/etc/init.d/postgresql.

ln -s /etc/init.d/postgresql /etc/rc0.d/K27postgresql
ln -s /etc/init.d/postgresql /etc/rc1.d/K27postgresql
ln -s /etc/init.d/postgresql /etc/rc2.d/S85postgresql
ln -s /etc/init.d/postgresql /etc/rc3.d/S85postgresql
ln -s /etc/init.d/postgresql /etc/rc4.d/S85postgresql
ln -s /etc/init.d/postgresql /etc/rc5.d/S85postgresql

etc ...

- Start PostgreSQL for the first time:

# /etc/init.d/postgres start

<\start>

No comments: