-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg
executable file
·65 lines (48 loc) · 1.47 KB
/
pg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
########################################################
# TERMUX - https://wiki.termux.com/wiki/Postgresql
#
# - https://thenewstack.io/a-cheat-sheet-to-database-access-control-postgresql/
# PostgreSQL 16.x - https://postgresql.org/about/news/postgresql-16-released-2715/
declare -xr PGVERSION=15
########################################################
declare -xr FIXPRE=${PREFIX:-/usr}
# declare -xr PGBIN=/usr/local/Cellar/postgresql@${PGVERSION}/${PGVERSION}.0_1/bin
declare -xr PGBIN=${FIXPRE}/bin
declare -xr EXEC=${PGBIN}/pg
declare -xr PGDATA=${PGDATA:-/usr/local/var/postgres@15}
declare -xr COMMAND=$1
declare -xr OPERATION=$2
declare -xr AUTH=--auth-local # --auth-host
declare -xr USERNAME=devpunks
declare -xr HOST=localhost
declare -xr PORT=${PORT:-5432}
# declare -xr PID=${PGDATA}/postmaster.pid
function status {
${EXEC}_ctl status --pgdata=$PGDATA
}
echo FIXPRE 👉 $FIXPRE
echo PGVERSION 👉 $PGVERSION
echo PGDATA 👉 $PGDATA
echo EXEC 👉 $EXEC
echo LOGDIR 👉 $LOGDIR
echo PORT 👉 $PORT
echo AUTH 👉 $AUTH
echo COMMAND 👉 $COMMAND
status
exit 0
# REMOVE ME!
# pg_ctl stop -D $PGDATA -l $LOGDIR -s -m fast
# ls $PGDATA
# rm -rf $PGDATA
# pg_ctl init -D $PGDATA -l $LOGDIR
# Run ls -al /usr/local/bin | grep pg_ for Postgres commands
# pg_dump[all]
# pg_verifybackup
# pg_upgrade
# pg_restore
# pg_isready
status
${EXEC}_${COMMAND} ${OPERATION} --pgdata=$PGDATA --log=$LOGDIR -s -m fast
#pg_ctl -l $LOGDIR -D $PGDATA $COMMAND -s -m fast
status