notes/config/pgsql/pg_dbg.sh

36 lines
651 B
Bash
Executable File

#!/bin/bash
PG_HOME=$HOME/PgDev/pg14
PG_CTL=$PG_HOME/bin/pg_ctl
start_pg() {
$PG_CTL -D $PG_HOME/master -l $PG_HOME/master.log start
# Sleep 5 seconds before start replica server
sleep 5
$PG_CTL -D $PG_HOME/replica -l $PG_HOME/replica.log start
}
stop_pg() {
$PG_CTL stop -D $PG_HOME/master
# Sleep 5 seconds before start replica server
sleep 5
$PG_CTL stop -D $PG_HOME/replica
}
main() {
case $1 in
start )
start_pg
;;
stop )
stop_pg
;;
* )
echo "Please $0 start|stop"
exit 1
;;
esac
}
main "$@"