[pgsql-jp: 35406] Red Hat系 pgpoolサービススクリプト

中嶋 正弘 nakajima @ thss.co.jp
2005年 5月 20日 (金) 17:59:59 JST


お世話になっております、中嶋と申します。

pgpoolを初めて使用しています。使用に伴って手動でpgpoolを立ち上げるのは
手間なので、サービススクリプトで制御できれば楽だと思い、試しに書いて
みました(Red Hat系用に書いています)。

以下の内容の/etc/init.d/pgpoolを実行形式にしてchkconfig --add pgpoolで
登録し、chkconfig --level 345 pgpool onでランレベル345で動くように
しました。

pidの扱いがイマイチ分からなかったのですが、とりあえず、起動・終了するのを
確認しています。

サービススクリプトとして何か間違いがあったらご指摘をよろしくお願いします。
m(_ _)m。

-----------------------------

#!/bin/sh
# popool This is the init script for starting up the popool
#  server
#
# chkconfig: - 65 36
# description: Starts and stops the popool backend daemon that handles \
#        all database requests.
# processname: popool
# pidfile: /var/run/popool.pid

. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
        exit 0
fi
# See how we were called.
case "$1" in
  start)
        echo -n "Starting pgpool services: "
        /usr/local/bin/pgpool start
        echo
        touch /var/lock/subsys/pgpool
        ;;
  stop)
        echo -n "Stopping pgpool services: "
        /usr/local/bin/pgpool stop
        sleep 2
        echo
        rm -f /var/lock/subsys/pgpool
        ;;
  status)
        status pgpool
        ;;
  restart|reload)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: skelton {start|stop|status|restart}"
        exit 1
esac
exit 0




pgsql-jp メーリングリストの案内