This is my deployment snippet:
APP="test"
DBPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
sudo -u postgres -H createuser --no-createrole --no-superuser --no-createdb $APP_main
sudo -u postgres -H createdb -O $APP_main $APP_main
sudo -u postgres -H psql -c "alter user $APP_main with password '$DBPASS'"
This is my log out:
/usr/lib/postgresql/9.1/bin/createdb: option requires an argument -- 'O'
Try "createdb --help" for more information.
ERROR: syntax error at or near "with password"
LINE 1: alter user with password 'hCGCly4ZVfu42Dr956ncypuf6mt0lBiY'
Can anyone explain what is going wrong? I have specified the O argument it just doesn't seem to accept it.