2024-12-06 21:19:09 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SUDOER_PSW=
|
2024-12-06 21:50:54 -05:00
|
|
|
function restofscript(){
|
|
|
|
pw_productiondatabase=
|
|
|
|
pw_developmentdatabase=
|
|
|
|
servicename=
|
|
|
|
service_dev="${servicename}_dev"
|
|
|
|
sudo -u postgres psql -c "create database $servicename;"
|
|
|
|
sudo -u postgres psql -c "create user $servicename with encrypted password '$pw_productiondatabase';"
|
|
|
|
sudo -u postgres psql -c "grant all privileges on database $servicename to $servicename;"
|
|
|
|
}
|
2024-12-06 21:19:09 -05:00
|
|
|
|
2024-12-06 21:50:54 -05:00
|
|
|
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"
|
2024-12-06 21:19:09 -05:00
|
|
|
exit
|