[pgsql-jp: 27282] Postgresの自動起動について
斉藤 慎也
saito @ hitachi-mi.co.jp
2002年 9月 3日 (火) 18:54:27 JST
たびたびすみません。斉藤です。
--環境--
OS:redhat linux7.3
備考:PostgreSQLは上記製品のパッケージの追加でインストールしました。。
--------
1.PostgreSQLを自動起動させようと思い、/etc/rc.d/init.d配下に
以下の起動スクリプト(postgres)を作成しました。
---------------------------------------------
#!/bin/sh
#
# postgres - This script is used to start/stop
# the postgreSQL listener process.
#
# Usage
#
# You can use this script manually, and/or you
# can install this script into the runlevel system
# by running "sh postgres.init.sh install"
#
# Credits
#
# Thomas Lockhart
# modified from other startup files in the
# RedHat Linux distribution
#
# Clark Evans
# cleaned up, added comments, etc.
#
# modified for PostgreSQL book written by Tatsuo Ishii
#
# RedHat Stuff
#
# chkconfig: 345 85 15
# description: Starts and stops the PostgreSQL backend daemon\
# that handles all database requests.
# processname: postmaster
#
# Config Variables
#
PGACCOUNT="postgres"
#
# The non-root user account which will be used to run the
# PostgreSQL executeable. For this script to work, the
# shell for this account must be SH/BASH.
#
PGDATA="/var/lib/pgsql/data"
POSTMASTER="/usr/bin/postmaster"
PG_CTL="/usr/bin/pg_ctl"
#
# The executable program which is to be run, in this case
# it is the listener, which waits for requests on the port
# specified during configuration.
#
# Source function library.
. /etc/rc.d/init.d/functions
#
# See how we were called.
#
case "$1" in
start)
echo -n "Starting postgres: "
su - $PGACCOUNT -c "$POSTMASTER -D $PGDATA -i"
echo
touch /var/lock/subsys/postgres
;;
stop)
echo -n "Stopping postgres: "
$PG_CTL -m f -D $PGDATA stop
echo
rm -f /var/lock/subsys/postgres
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
---------------------------------------------
2.作成したpostgresモードの変更。
# chmod 755 postgres
3.起動スクリプトを追加。
# chkconfig --add postgres
4.再起動したところpostgresの起動のところで、
”Starting postgres:”が表示され動かなくなってしまいました。。
復旧方法はあるのでしょうか?
また上記スクリプトの何処が誤っているのでしょうか?
大変申し訳ありませんが、どなたかご教授お願いいたします。
以上、宜しくお願い致します。
pgsql-jp メーリングリストの案内