summaryrefslogtreecommitdiff
path: root/databases/postgresql/files/pgsql.sh.tmpl
blob: 8b7c4c0515867bd5d1bbdbe0f1dfbc5455c30b52 (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
#!/bin/sh

# $NetBSD: pgsql.sh.tmpl,v 1.6 2000/07/14 04:44:12 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

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

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