]> git.8kb.co.uk Git - slony-i/pgbouncer_follower/blob - init.debian
Add support for auth_user and ensure nodes currently being cloned are never used.
[slony-i/pgbouncer_follower] / init.debian
1 #!/bin/bash
2
3 ### BEGIN INIT INFO
4 # Provides:          pgbouncer_follower_rw
5 # Required-Start:    $network $local_fs $remote_fs $syslog
6 # Required-Stop:     $network $local_fs $remote_fs $syslog
7 # Default-Start:     2 3 4 5
8 # Default-Stop:      0 1 6
9 # Short-Description: Start pgbouncer_follower_rw daemon at boot time
10 # Description:       Enable pgbouncer_follower_rw service.
11 ### END INIT INFO
12
13 NAME=pgbouncer_follower_rw
14 USER=root
15 DAEMON=/var/slony/pgbouncer_follower/pgbouncer_follower.pl
16 CFGFILE=/var/slony/pgbouncer_follower/$NAME.conf
17 DAEMON_OPTS="-f $CFGFILE -D"
18 PIDFILE=/var/run/$NAME.pid
19 # note: SSD is required only at startup of the daemon.
20 SSD=`which start-stop-daemon`
21 ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/pgsql/bin"
22
23 trap "" 1
24
25 case "$1" in
26   start)
27     echo -n "Starting server: $NAME"
28     su $USER -c "$ENV $SSD --start --pidfile $PIDFILE --background --quiet --exec $DAEMON -- $DAEMON_OPTS"
29     ;;
30
31   stop)
32     echo -n "Stopping server: $NAME"
33     su $USER -c "$SSD --stop --pidfile $PIDFILE"
34     ;;
35
36   restart)
37     $0 stop
38     $0 start
39     ;;
40
41   *)
42     echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
43     exit 1
44     ;;
45 esac
46
47 if [ $? -eq 0 ]; then
48     echo .
49     exit 0
50 else
51     echo " failed"
52     exit 1
53 fi
54