freebsd-ports/japanese/postgresql/files/pgsql.sh.tmpl
Thomas Gellekum 546041ba31 As threatened on freebsd-ports: all startup scripts know about the two
options `start' and `stop' now (unless I have forgotten any). This allows
us to call the scripts from /etc/rc.shutdown with the correct option.

The (42 or so) ports that already DTRT before are unchanged.
2000-07-05 12:37:06 +00:00

40 lines
1.0 KiB
Bash

#!/bin/sh
# $FreeBSD$
# pgsql.sh - postgresql startup file for FreeBSD and possibly *BSD (untested)
# Changes:
# - renamed startup script to be in sync with INSTALL file
# - merged ldconfig start sequence from former postgrsql.sh script (andreas)
# - modified the postmaster startup sequence as suggested in the
# INSTALL file which was given as example for FreeBSD 2.2 (andreas)
# - removed the commandline option
# -D!!PG_PATH!!/data \
# because the postmaster process, which starts up under the
# environment of the pgsql user, sets this with the PGDATA
# environment variable in !!PG_PATH!!/.profile
#
case "$1" in
start)
[ -d !!PG_PATH!!/lib ] && /sbin/ldconfig -m !!PG_PATH!!/lib
[ -x !!PG_PATH!!/bin/postmaster ] && {
su -l !!PGSQL_UID!! -c 'exec !!PG_PATH!!/bin/postmaster -i -S -o -F \
-D!!PG_PATH!!/data > !!PG_PATH!!/errlog'
echo -n ' PostgreSQL'
}
;;
stop)
# XXX some pgsql user should check this --tg
killall !!PG_PATH!!/bin/postmaster
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
exit 0