X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D24E6D1DF4D for ; Thu, 18 Mar 2004 15:56:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06733-03 for ; Thu, 18 Mar 2004 11:56:16 -0400 (AST) Received: from silmaril.syscor.priv (h24-108-208-253.sbm.shawcable.net [24.108.208.253]) by svr1.postgresql.org (Postfix) with ESMTP id 4A591D1D2E2 for ; Thu, 18 Mar 2004 11:56:11 -0400 (AST) Received: from syscor.com (strider.syscor.priv [192.168.1.3]) by silmaril.syscor.priv (8.12.8/8.12.8) with ESMTP id i2IFuGXR015873; Thu, 18 Mar 2004 07:56:17 -0800 Message-ID: <4059C6D5.3010201@syscor.com> Date: Thu, 18 Mar 2004 07:57:09 -0800 From: Ron St-Pierre User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Raul Secan , pgsql-php@postgresql.org Subject: Re: running postgresql as a linux service References: <001b01c40cfc$c6af5dd0$0a10a8c0@zerosoft.ro> In-Reply-To: <001b01c40cfc$c6af5dd0$0a10a8c0@zerosoft.ro> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/45 X-Sequence-Number: 2644 Raul Secan wrote: > Hello, I have succesfuly installed PostgreSQL 7.4.1, on my OS which is > Red Hat Linux 9.0. > > I start the server with: > $ pg_ctl -D /usr/local/pgsql/data -l logfile start > > And stop it with: > $ pg_ctl -D /usr/local/pgsql/data stop -m fast > > There are two questions here, which I want to put to you guys: > 1. How can make PostgreSQL run as a Linux service so database server > starts at each reboot Below are the steps I use when I manually install PostgreSQL to have it running when the server starts. However I don't use Red Hat, I use Mandrake instead. You should be able to find the corresponding files on your server if you know the installation directories for your PostgreSQL, or use utilities like 'locate' or 'find' to find out where they are installed. *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/postgres .... 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/postgres. If the normal runlevel is 3 then you really only need to add it to rc3.d: # ln -s /etc/init.d/postgres /etc/rc2.d/S85postgres # ln -s /etc/init.d/postgres /etc/rc3.d/S85postgres etc ... - Start PostgreSQL for the first time: # /etc/init.d/postgres start <\start> > 2. How can I register the PGDATA environment variable, so I don't have > to use -D /usr/local/pgsql/data parameter (and don't use -l logfile if > it is posible) when run the start command > If step 1. works correctly, the PGDATA variable is set properly. Otherwise edit the /etc/init.d/postgres file. > Thanks, Raul Secan. Ron