3 # pgpool This is the init script for starting up pgpool
6 # description: Pgpool - a connection pooling/replication server for PostgreSQL
8 # pidfile: /var/run/pgpool.pid
9 # config: /etc/pgpool.conf
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
18 [ -f /etc/sysconfig/pgpool ] && . /etc/sysconfig/pgpool
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23 msg_network_down pgpool
30 if [ ! -f $PGPOOLLOG ]; then
36 # Check if the service is already running?
37 if [ ! -f /var/lock/subsys/pgpool ]; then
39 rm -f $PGPOOLPID > /dev/null 2>&1
40 pgpool -f $PGPOOLCONF \
42 $OPTS >> $PGPOOLLOG 2>&1 #< /dev/null
44 pid_num=`pidof -s /usr/bin/pgpool`
46 echo "Master PID number $pid_num" >> $PGPOOLLOG
47 echo -n $pid_num > $PGPOOLPID
48 touch /var/lock/subsys/pgpool
54 # [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pgpool
56 msg_already_running pgpool
63 if [ -f /var/lock/subsys/pgpool ]; then
66 /usr/bin/pgpool stop >> $PGPOOLLOG 2>&1
67 # killproc --waitforname pgpool --waitfortime 60 pgpool
69 rm -f /var/lock/subsys/pgpool /var/run/pgpool.pid >/dev/null 2>&1
75 msg_not_running pgpool
80 # See how we were called.
97 if [ -f /var/lock/subsys/pgpool ]; then
99 pgpool switch >> $PGPOOLLOG 2>&1
102 msg_not_running pgpool
107 msg_usage "$0 {start|stop|restart|switch|status}"