这个启动脚本可能得自己配置三个变量:POSTGRESQL_CTL,DATABASE_DIR和LOG_FILE。配置好这三个变量后把脚本搁到/etc/init.d下,然后再在/etc/rc1.d下建立K36postgres、在/etc/rc3.d下建立S64postgres两个符号连接指向该脚本就行了。
#! /bin/bash
#
# This is PostgreSQL 8.2 init script for Solaris 10.
# Author's blog: http://venturor.blogspot.com
#
# the place of pg_ctl:
POSTGRESQL_CTL=/usr/postgres/8.2/bin/pg_ctl
# database home path:
DATABASE_DIR=/var/postgres/8.2/data/pasta
# the place of log file, and the user (i.e. postgres) must have the rwx privilege over the file:
LOG_FILE=/var/log/postgres_pasta.log
case "$1" in
start)
su - postgres -c "$POSTGRESQL_CTL start -D $DATABASE_DIR -l $LOG_FILE"
;;
stop)
su - postgres -c "$POSTGRESQL_CTL stop -D $DATABASE_DIR"
;;
status)
su - postgres -c "$POSTGRESQL_CTL status -D $DATABASE_DIR"
;;
restart)
su - postgres -c "$POSTGRESQL_CTL restart -D $DATABASE_DIR -l $LOG_FILE"
;;
*)
echo "Usage: {start|stop|status|restart}"
exit 1
;;
esac
exit $?
没有评论:
发表评论