1

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.

1 Answer 1

2

The problem is in:

$APP_main

You perhaps wanted to append _main to the variable $APP. Instead say:

${APP}_main

This would expand the variable $APP and append _main to it.

Sign up to request clarification or add additional context in comments.

1 Comment

@Rob3 That's a purely database question. I'd say that you ask that in a different thread!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.