summaryrefslogtreecommitdiff
path: root/databases/postgresql/files/pgsql.sh.tmpl
blob: 17d9a49fb6687ae32fe69d453774d52d5f8adaa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
#
# $NetBSD: pgsql.sh.tmpl,v 1.8 2000/09/21 14:34:56 jlam Exp $
# FreeBSD Id: pgsql.sh.tmpl,v 1.3 1997/10/05 21:00:49 andreas Exp
#
# pgsql.sh - postgresql startup file for NetBSD
#
# PROVIDE: pgsql
# REQUIRE: DAEMON

CMD=${1:-start}
USER=@PGUSER@

if [ -x @PREFIX@/bin/postmaster -a -x @PREFIX@/bin/pg_ctl ]
then
	case ${CMD} in
	start)
		echo -n ' pgsql' 
		su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl \
			-p @PREFIX@/bin/postmaster -o "-S -o -F" start \
			> @PGHOME@/errlog'
		;;
	stop)
		su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl stop \
			>> @PGHOME@/errlog'
		;;
	restart)
		su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl restart \
			>> @PGHOME@/errlog'
		;;
	status)
		su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl status'
		;;
	*)
		echo "Unexpected argument: ${CMD}"
		;;
	esac
fi