aports/community/slony1/slony1.initd
2018-11-07 09:46:25 +00:00

42 lines
770 B
Plaintext

#!/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 $?
}