diff options
author | startxfr <clarue@startx.fr> | 2015-11-30 03:25:20 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2015-11-30 03:25:20 +0100 |
commit | ff24be233ac7b10221142675b205b347b5588fd7 (patch) | |
tree | 3cef32fbae043936558b528f9e421109ef547614 /Services/postgres/sx | |
parent | d3189d55206417557b03fde732693aaffca54cf8 (diff) | |
download | phpmyadmin-ff24be233ac7b10221142675b205b347b5588fd7.tar.gz phpmyadmin-ff24be233ac7b10221142675b205b347b5588fd7.tar.bz2 phpmyadmin-ff24be233ac7b10221142675b205b347b5588fd7.tar.xz phpmyadmin-ff24be233ac7b10221142675b205b347b5588fd7.zip |
reshape of postgresql
Diffstat (limited to 'Services/postgres/sx')
-rw-r--r-- | Services/postgres/sx/postgresql.sh | 66 | ||||
-rw-r--r-- | Services/postgres/sx/postgresql_run.sh | 7 |
2 files changed, 0 insertions, 73 deletions
diff --git a/Services/postgres/sx/postgresql.sh b/Services/postgres/sx/postgresql.sh deleted file mode 100644 index 7b57905..0000000 --- a/Services/postgres/sx/postgresql.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -export TERM=dumb - -# Begin configuration before starting daemonized process -# and start generating host keys -function begin_config { - echo "=> Begin postgresql configuration for host $HOSTNAME" - postgresql-setup initdb - postgresql-setup upgrade - start_server - update_rootuser -} - -# End configuration process just before starting daemon -function end_config { - stop_server - echo "=> End postgresql configuration ..." -} - -# Start the postgresql server in background. Used to perform config -# against the database structure such as user creation -function start_server { - echo "===> Starting postgresql server ..." - /usr/bin/postgres -} - -# Stop the postgresql server running in background. -function stop_server { - echo "===> Stopping postgresql server ..." - killall postgres -} - -# Set new root password and grant permissions to all databases -function update_rootuser { - if [ "$pgsql_newadminpwd" = "" ]; then - export pgsql_newadminpwd=$(pwgen 13 1); - fi - local n=$pgsql_newadminpwd; - echo "===> Update root user password and permission" - sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '$pgsql_newadminpwd';" - unset pgsql_newadminpwd; - export PGSQL_ROOTPWD=$n; - echo "========================================================================"; - echo "You can now connect to this PostgresQL Server using the following credentials:"; - echo " "; - echo " user type : administrator"; - echo " username : postgres"; - echo " password : $n"; - echo " "; - echo " psql -h <host> -p <port> --username=postgres; $n"; - echo "========================================================================"; - echo " "; - return 0 -} - -# Start the postgresql server as a deamon and execute it inside -# the running shell -function start_daemon { - echo "=> Starting postgresql daemon ..." - exec /usr/bin/postgres -D /var/lib/pgsql/data -c config_file=/var/lib/pgsql/postgresql.conf -} - - -if [[ "$0" == *"postgresql.sh" && ! $1 = "" ]];then - eval "$@"; -fi
\ No newline at end of file diff --git a/Services/postgres/sx/postgresql_run.sh b/Services/postgres/sx/postgresql_run.sh deleted file mode 100644 index 9504ff5..0000000 --- a/Services/postgres/sx/postgresql_run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -source /sx/postgresql.sh - -begin_config -end_config - -start_daemon
\ No newline at end of file |