Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start postgresql server on linux system boot [closed]

I want to make the postgresql server on my linux machine to start automatically at system boot. i added the following line in ~/.profile file:

su -c 'pg_ctl start -D /var/lib/pgsql/data ' postgres

however the postgres server doesn't start untill i lauch the console command . i'm then prompted to input password of user 'postgres' and then the server starts up correctly.

i want to avoid the two extar steps of lauching the linux console and entering the password for 'postgres' user. How can i do that?

like image 500
othman Avatar asked Jul 29 '12 22:07

othman


1 Answers

Here is an excerpt from the 8.0 manual that shows you how to do this with 8.* and for different distributions:

http://www.postgresql.org/docs/8.0/static/postmaster-start.html

and here is for the most recent released version: http://www.postgresql.org/docs/9.1/static/server-start.html

On Linux systems either add
/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data
to /etc/rc.d/rc.local or /etc/rc.local
or look at the file
contrib/start-scripts/linux in the PostgreSQL source distribution.

Check paragraph starting with "Different systems have different conventions for starting up daemons at boot time."

Hope this helps.
Edmon

like image 101
Edmon Avatar answered Oct 30 '22 21:10

Edmon