aboutsummaryrefslogtreecommitdiffstats
path: root/community/slony1/slony1.initd
blob: 1de7a8097f9a51be943ca451d566045291f6d775 (plain) (blame)
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
#!/sbin/openrc-run

pidfile=/var/run/slony/slony1.pid
command=/usr/bin/slon
config=/etc/slon.conf

depend() {
	need postgresql net
	after firewall
}

start_pre() {
	checkpath --directory ${pidfile%/*}
	if ! [ -e "$config" ]; then
		eerror "config file $config is missing"
		return 1
	fi
	if [ -n "$LOGFILE" ]; then
		ewarn "LOGFILE in /etc/conf.d/slony1 is ignored. Only syslog is supported."
	fi
	if [ -n "$LOGLEVEL" ]; then
		ewarn "LOGLEVEL in /etc/conf.d/slony1 is ignored."
	fi
}

start() {
	ebegin "Starting slony1"
	if [ -n "$CLUSTER" ]; then
		set -- $CLUSTER "dbname=$DBNAME user=$DBUSER host=$DBHOST"
	fi
	start-stop-daemon --exec $command \
		--pidfile "$pidfile" \
		--background \
		--wait 100 \
		-- \
		-p "$pidfile" \
		-f "$config" \
		"$@"
	eend $?
}