github.com/dnephin/dobi@v0.15.0/examples/init-db-with-rails/db/load.sh (about) 1 #!/bin/bash 2 set -eux 3 4 mkdir -p "$PGDATA" 5 chmod 700 "$PGDATA" 6 chown -R postgres "$PGDATA" 7 8 chmod g+s /run/postgresql 9 chown -R postgres /run/postgresql 10 11 gosu postgres initdb 12 authMethod=trust 13 { echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf" 14 15 gosu postgres pg_ctl -D "$PGDATA" \ 16 -o "-c listen_addresses='localhost'" \ 17 -w start 18 19 gosu postgres psql < export.sql 20 21 gosu postgres pg_ctl -D "$PGDATA" -w stop