#!/bin/sh ######################################################################## # Begin postgresql # # Description : Start PostgreSQL Server # # Author : Ken Moffat - ken@linuxfromscratch.org # # Version : BLFS 7.0 # # Notes : Based on the earlier version by Gerard Beekmans # ######################################################################## ### BEGIN INIT INFO # Provides: postgresql # Required-Start: $network # Should-Start: networkmanager wicd # Required-Stop: $network # Should-Stop: networkmanager wicd # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts PostgreSQL server. # Description: Starts PostgreSQL server. # X-LFS-Provided-By: BLFS ### END INIT INFO . /lib/lsb/init-functions case "$1" in start) log_info_msg "Starting PostgreSQL daemon..." install -dm755 -o postgres -g postgres /run/postgresql if ! pidofproc postgres >/dev/null; then su - postgres -c '/usr/bin/pg_ctl start -s -D /srv/pgsql/data \ -l /srv/pgsql/data/logfile -o "-i" ' fi evaluate_retval ;; stop) log_info_msg "Stopping PostgreSQL daemon..." if pidofproc postgres >/dev/null; then su - postgres -c "/usr/bin/pg_ctl stop -m smart -s -D /srv/pgsql/data" fi evaluate_retval ;; restart) $0 stop sleep 1 $0 start ;; status) su - postgres -c "/usr/bin/pg_ctl status -D /srv/pgsql/data" ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac # End /etc/init.d/postgresql