psql -c "create user $1 createdb;" template1
psql -c "create database $1 with encoding 'unicode';" -U $1 template1
psql -c "alter user $1 nocreatedb;" template1
psql -c "alter user $1 with encrypted password '$1';" template1
chmod 755 createdb.sh
su - postgres
./createdb.sh dbname