blob: d0b2db0ab0022447215b3816d0ce7b076d069fa9 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: pgcluster
# REQUIRE: DAEMON
# BEFORE: pgreplicate
# KEYWORD: FreeBSD
#
# Add the following line to /etc/rc.conf to enable pgcluster:
#
# pgcluster_enable="YES"
# # optional
# pgcluster_data="/home/pgsql/data"
# pgcluster_flags="-w -s"
#
pgcluster_enable="NO"
pgcluster_data="%%PREFIX%%/pgsql/data"
pgcluster_flags="-w -s"
. %%RC_SUBR%%
load_rc_config pgcluster
name=pgcluster
command=%%PREFIX%%/bin/pg_ctl
pgcluster_user=pgsql
extra_commands="initdb recover"
initdb_cmd="pgcluster_initdb"
recover_cmd="pgcluster_recover"
start_cmd="pgcluster_start"
stop_cmd="pgcluster_stop"
pgcluster_flags="${pgcluster_flags} -D ${pgcluster_data}"
pidfile="${pgcluster_data}/postmaster.pid"
pgcluster_start()
{
su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o '-i'"
}
pgcluster_stop()
{
su -m ${pgcluster_user} -c "exec ${command} stop ${pgcluster_flags} -m i"
}
pgcluster_recover()
{
su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o '-i -R'"
}
pgcluster_initdb()
{
su -m ${pgcluster_user} -c "exec %%PREFIX%%/bin/initdb -D ${pgcluster_data}"
}
load_rc_config $name
run_rc_command "$1"
|