summaryrefslogtreecommitdiffstats
path: root/main/slony1/slony1.initd
blob: 132aa1ebe04b34affd32f546e85c63189b889aae (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
#!/sbin/runscript

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 $?
}