Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

sudo -u postgres psql -d ckpool -c "DROP TABLE IF EXISTS public.shares;"
echo "Table Dropped: shares"
sudo -u postgres psql -c "DROP DATABASE IF EXISTS ckpool;"
echo "DB Dropped: ckpool"

PG_HBA_PATH=$(sudo -u postgres psql -t -c "SHOW hba_file;" | xargs)
sudo cp ${PG_HBA_PATH}.bak $PG_HBA_PATH
echo "Backup restored: ${PG_HBA_PATH}.bak"

sudo -u postgres psql -c "DROP USER satoshi;"
echo "User Dropped: satoshi CASCADE;"

sudo systemctl stop postgresql
echo "Postgres Stopped: restart with 'just psql'"