cat >> /etc/profile << EOF
export PGHOME=/data/pgsql
export PGDATA=/data/pgsql/pgsql_data
export PATH=$PATH:$HOME/bin:$PGHOME/bin
EOF
vim pgsql_service
#!/bin/bash
#
#autor wxg
. /etc/profile
dataDir="/data/pgsql/pgsql_data"
logfile="/data/pgsql/logfile"
case $1 in
start)
pg_ctl -D $dataDir -l $logfile start
;;
status)
pg_ctl -D $dataDir -l $logfile status
;;
stop)
pg_ctl -D $dataDir -l $logfile stop
;;
restart)
pg_ctl -D $dataDir -l $logfile stop
pg_ctl -D $dataDir -l $logfile start
;;
reload)
pg_ctl -D $dataDir -l $logfile reload
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
esac
网友评论