-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpg
More file actions
executable file
·68 lines (52 loc) · 1.51 KB
/
Copy pathpg
File metadata and controls
executable file
·68 lines (52 loc) · 1.51 KB
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
66
67
68
#!/bin/bash
########################################################
# TERMUX - https://wiki.termux.com/wiki/Postgresql
#
# https://thenewstack.io/a-cheat-sheet-to-database-access-control-postgresql
########################################################
# Debian /usr
# Darwin /usr/local
# MacOS >M1 /opt/homebrew
# Termux /data/data/com.termux/files/usr
declare -xr PREFIX=${PREFIX:-/usr/}
declare -xr LOGDIR=${LOGDIR:-$PREFIX/var/log}
declare -xr PGBIN=${PREFIX}/bin
declare -xr EXEC=${PGBIN}/pg_
# Darwin / MacOS >M1 $PREFIX/var/postgres
# Debian / Termux $PREFIX/var/lib/pgsql/data
declare -xr PGDATA=${PGDATA:-$PREFIX/var/lib/pgsql/data}
declare -xr COMMAND=$1
declare -xr OPERATION=$2
declare -xr PORT=5432
declare -xr HOST=localhost
declare -xr USERNAME=devpunks
declare -xr AUTH=--auth-local # --auth-host
# declare -xr PID=${PGDATA}/postmaster.pid
# function status {
# ${EXEC}ctl status --pgdata=$PGDATA
# }
echo PREFIX 👉 $PREFIX
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