This section is from the "Practical PostgreSQL" book, by John Worsley and Joshua Drake. Also available from Amazon: Practical PostgreSQL.
The SysV script will allow the graceful control of the PostgreSQL database through the use of the SysV runlevel system. This includes, starting, stopping and status checking of PostgreSQL. If you would like to use the SysV start up script, then you will need to copy the linux script to the init.d directory. The following operations may require root access. First, change directories to the path where you unpacked the PostgreSQL 7.1.2 source. In our case, the path is /usr/local/src/postgresql-7.1.2/. In this directory you will want to change into the containing the SysV script under the contrib directory. This is located in src/contrib/start-scripts Then copy the SysV script to the init.d directory of your Linux installation.
cd /usr/local/src/postgresql-7.1.2/ cp contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
![]() | SysV start up script |
---|---|
This script is known to work with most Red Hat based versions of Linux, including Mandrake. However, it should work with other SysV systems (UnixWare, Solaris etc..) with little modification. |
After having copied the file, you will probably need to change the access permission. You can do this by using the following command:
chmod a+x /etc/rc.d/init.d/postgresql
You can now use the following commands on Red Hat and Mandrake linux distributions to start the PostgreSQL database.
service postgresql start Starting PostgreSQL: ok
 
Continue to: