build files for making podman containers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
413 B

#!/bin/bash
cmd() {
sudo -u postgres psql -c "$1"
}
. /usr/local/bin/maint-mode
mode_get
mode_on
cd /var/lib/postgresql
cmd "DROP DATABASE IF EXISTS ${DBNAME:?};"
cmd "DROP USER IF EXISTS ${DBUSER:?};"
cmd "CREATE USER ${DBUSER:?};"
cmd "CREATE DATABASE ${DBNAME:?};"
cmd "GRANT ALL PRIVILEGES ON DATABASE ${DBNAME:?} TO ${DBUSER:?};"
redis-cli -s /var/run/redis/redis-server.sock flushall
mode_off