/etc/init.d/slony1 is in slony1-2-bin 2.2.4-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | #!/bin/sh
### BEGIN INIT INFO
# Provides: slony1
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: $time postgresql
# Should-Stop: $time postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start Slony-I daemon
# Description: Slony-I is a replication system for PostgreSQL.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/slon
SLON_START_ARGS="--nowatchdog"
test -x $DAEMON || exit 5
if [ -r /etc/default/slony1 ]; then
. /etc/default/slony1
fi
. /lib/lsb/init-functions
instances() {
ls /etc/slony1/*/slon.conf 2>/dev/null | sed -n 's,^/etc/slony1/\(.*\)/slon.conf$,\1,p'
echo $SLON_TOOLS_START_NODES | sed -r 's/\b[0-9]+\b/node&/g'
}
conffile() {
echo "/etc/slony1/$1/slon.conf"
}
logfile() {
echo "/var/log/slony1/slon-$1.log"
}
pidfile() {
echo "/var/run/slony1/$1.pid"
}
prepare_start() {
mkdir -p /var/run/slony1 \
&& chown postgres:postgres /var/run/slony1/ \
&& chmod 2775 /var/run/slony1/
}
d_start() {
if [ -e $(conffile $1) ]; then
su -c ". /lib/lsb/init-functions ; umask 027 ; start_daemon -p $(pidfile $1) $DAEMON -f $(conffile $1) -p $(pidfile $1) >>$(logfile $1) 2>&1 </dev/null &" - postgres
else
local cluster node
if echo "$1" | grep -q -- ':'; then
cluster=$(echo "$1" | cut -d: -f1)
node=$(echo "$1" | cut -d: -f2)
else
node=$1
fi
is_running $1 || su -c "umask 027 ; slon_start ${cluster+"--config /etc/slony1/slon_tools_${cluster}.conf"} $SLON_START_ARGS $node >/dev/null" - postgres
fi
}
d_stop() {
killproc -p $(pidfile $1) $DAEMON
}
is_running() {
pidofproc -p $(pidfile $1) $DAEMON >/dev/null
}
case $1 in
start)
status=0
log_daemon_msg "Starting Slony-I daemon"
prepare_start
for x in $(instances); do
log_progress_msg $x
d_start $x
status=$(($status || $?))
done
log_end_msg $status
;;
stop)
status=0
log_daemon_msg "Stopping Slony-I daemon"
for x in $(instances); do
log_progress_msg $x
d_stop $x
status=$(($status || $?))
done
log_end_msg $status
;;
status)
status=0
for x in $(instances); do
is_running $x
instancestatus=$?
if [ $instancestatus -eq 0 ]; then
log_success_msg "Slony-I daemon $x is running"
else
log_failure_msg "Slony-I daemon $x is not running"
fi
status=$(($status || $instancestatus))
done
exit $((3 * $status))
;;
restart|force-reload)
status=0
log_daemon_msg "Restarting Slony-I daemon"
for x in $(instances); do
log_progress_msg $x
d_stop $x && sleep 1 && d_start $x
status=$(($status || $?))
done
log_end_msg $status
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
exit 3
;;
*)
log_failure_msg "Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
exit 2
;;
esac
|