postgresql/postgresql-initscript

46 lines
1.1 KiB
Bash

#!/bin/bash
# Begin $rc_base/init.d/postgres
#
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
#
# chkconfig: 345 60 25
# description: The PostgreSQL DBMS
#
source /etc/sysconfig/rc
source $rc_functions
case "$1" in
start)
echo -n "Starting PostgreSQL daemon..."
su -s /bin/sh - postgres -c '/usr/bin/pg_ctl start -W -D /var/pgsql/data \
-l /var/pgsql/data/logfile -o "-i" '
evaluate_retval
echo
;;
stop)
echo -n "Stopping PostgreSQL daemon..."
su -s /bin/sh - postgres -c '/usr/bin/pg_ctl stop -m smart -D /var/pgsql/data'
evaluate_retval
echo
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
/usr/bin/pg_ctl status -D /var/pgsql/data
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
# End $rc_base/init.d/