Skip to content

Instantly share code, notes, and snippets.

@RedstoneWizard08
Created June 30, 2024 15:50
Show Gist options
  • Save RedstoneWizard08/97a5a97fc311218ef32b7e0717e071d9 to your computer and use it in GitHub Desktop.
Save RedstoneWizard08/97a5a97fc311218ef32b7e0717e071d9 to your computer and use it in GitHub Desktop.
#!/data/data/com.termux/files/usr/bin/bash
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then
echo "Usage: $0 [username] [db] [dir]"
exit 1
fi
dir="$3"
pkg i -y postgresql
mkdir -p "$dir"
initdb "$dir"
pg_ctl -D "$dir" start
createuser --superuser --pwprompt "$1"
createdb "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment