自制pgsql启动脚本

2021-01-14  本文已影响0人  Virtualice

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

上一篇下一篇

猜你喜欢

热点阅读