-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.debian
53 lines (45 loc) · 1.18 KB
/
init.debian
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
#!/bin/bash
### BEGIN INIT INFO
# Provides: slony_failover
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start slony_failover daemon at boot time
# Description: Enable slony_failover service.
### END INIT INFO
NAME=slony_failover
USER=root
DAEMON=/var/slony/slony_failover/$NAME.pl
CFGFILE=/var/slony/slony_failover/$NAME.conf
DAEMON_OPTS="-f $CFGFILE"
PIDFILE=/var/run/$NAME.pid
# note: SSD is required only at startup of the daemon.
SSD=`which start-stop-daemon`
ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/pgsql/bin"
trap "" 1
case "$1" in
start)
echo -n "Starting server: $NAME"
su $USER -c "$ENV $SSD --start --pidfile $PIDFILE --background --quiet --exec $DAEMON -- $DAEMON_OPTS"
;;
stop)
echo -n "Stopping server: $NAME"
su $USER -c "$SSD --stop --pidfile $PIDFILE"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
exit 1
;;
esac
if [ $? -eq 0 ]; then
echo .
exit 0
else
echo " failed"
exit 1
fi