freebsd-ports/databases/postgresql73-server/files/pgsql.sh.tmpl
Sergey A. Osokin 861994e7a0 The control script that ships with the postgres
port (files/pgsql.sh.tmpl) lacks a parameter in the
restart option, causing logs to be send to stdout,
instead of the log file.

Submitted by:	Fernando Schapachnik <fernando@mecon.gov.ar>
Approved by:	maintainer
PR:		53142
Approved by:	fjoe (implicit)
2003-06-11 23:25:24 +00:00

49 lines
961 B
Bash

#!/bin/sh
# $FreeBSD$
#
# For postmaster startup options, edit $PGDATA/postgresql.conf
#
# Note that PGDATA is set in ~pgsql/.profile, don't try to manipulate it here!
#
PREFIX=%%PREFIX%%
PGBIN=${PREFIX}/bin
logfile=/var/log/pgsql
case $1 in
start)
touch ${logfile}
chmod 600 ${logfile}
chown pgsql:pgsql ${logfile}
[ -x ${PGBIN}/pg_ctl ] && {
su -l pgsql -c \
"[ -d \${PGDATA} ] && exec ${PREFIX}/bin/pg_ctl start -s -w -l ${logfile}"
echo -n ' pgsql'
}
;;
stop)
[ -x ${PGBIN}/pg_ctl ] && {
su -l pgsql -c "exec ${PREFIX}/bin/pg_ctl stop -s -m fast"
echo -n ' pgsql'
}
;;
restart)
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l pgsql -c "exec ${PREFIX}/bin/pg_ctl restart -s -m fast -l ${logfile}"
}
;;
status)
[ -x ${PGBIN}/pg_ctl ] && {
exec su -l pgsql -c "exec ${PREFIX}/bin/pg_ctl status"
}
;;
*)
echo "usage: `basename $0` {start|stop|restart|status}" >&2
exit 64
;;
esac