Post Closed as "off-topic" by John WH Smith, Archemar, jasonwryan, slm
5 deleted 73 characters in body
source | link

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
#################
# Database
#################
printf 'CREATE USER koko WITH NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD 'kokopass';\nCREATE DATABASE kokodb WITH OWNER koko;' > cartaro.sql
su postgres
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

Here is my script

when i execute the script

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
#################
# Database
#################
printf 'CREATE USER koko WITH NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD 'kokopass';\nCREATE DATABASE kokodb WITH OWNER koko;' > cartaro.sql
su postgres
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

Here is my script

when i execute the script

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
#################
# Database
#################
printf 'CREATE USER koko WITH NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD 'kokopass';\nCREATE DATABASE kokodb WITH OWNER koko;' > cartaro.sql
su postgres
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

when i execute the script

4 added 176 characters in body
source | link

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
su#################
# postgresDatabase
wget#################
printf http://qgis.fr/script/'CREATE USER koko WITH NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD 'kokopass';\nCREATE DATABASE kokodb WITH OWNER koko;' > cartaro.sql
su postgres
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

Here is my script

when i execute the script

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
su postgres
wget http://qgis.fr/script/cartaro.sql
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

Here is my script

when i execute the script

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
#################
# Database
#################
printf 'CREATE USER koko WITH NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD 'kokopass';\nCREATE DATABASE kokodb WITH OWNER koko;' > cartaro.sql
su postgres
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

Here is my script

when i execute the script

3 added 164 characters in body
source | link

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash
sudo apt-get updatex
sudo su postgres
createuser koko with passwordwget 'mypswd';http://qgis.fr/script/cartaro.sql
createdbpsql --encoding=UTF-8f --owner=kokocartaro.sql
echo kokodb"Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
exit
cdecho /tmp"Finished Database section"
exit

Here is my script

when i execute the script

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash
sudo apt-get update
sudo su postgres
createuser koko with password 'mypswd';
createdb --encoding=UTF-8 --owner=koko kokodb
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
exit
cd /tmp

Here is my script

I want to make an automated script to make a database user and password in Postgresql and also import some databases. When i execute my script bellow it stops somewhere and when i log out (CTRL+D or exit command) it tries to import database and it says:

psql: FATAL:  role "username" does not exist

At the end it doens't go to /tmp I'm using Ubuntu 14.10 and here is my script:

#!/bin/bash -x
su postgres
wget http://qgis.fr/script/cartaro.sql
psql -f cartaro.sql
echo "Running postgis.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
echo "Running postgis_comments.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis_comments.sql
echo "Running spatial_ref_sys.sql"
psql -d "kokodb" -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d "kokodb" -c 'grant all on geometry_columns to "koko";'
psql -d "kokodb" -c 'grant all on spatial_ref_sys to "koko";'
echo "Finished Database section"
exit

Here is my script

when i execute the script

2 added 89 characters in body
source | link
1
source | link