Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gydST-00087Z-1p for pgsql-admin@arkaria.postgresql.org; Tue, 26 Feb 2019 14:11:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gydSR-0003hY-Mc for pgsql-admin@arkaria.postgresql.org; Tue, 26 Feb 2019 14:11:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gydSR-0003hQ-2C for pgsql-admin@lists.postgresql.org; Tue, 26 Feb 2019 14:11:43 +0000 Received: from sonic308-2.consmr.mail.bf2.yahoo.com ([74.6.130.41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gydSN-0002PV-2R for pgsql-admin@lists.postgresql.org; Tue, 26 Feb 2019 14:11:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1551190296; bh=ikTfQoCkKZ10W/zPCL8FKB/Tw+uoxdY3TNFlNitX5uo=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=KsfDB3jFcQfXCes6ulhWWJyeYiuOwFA8zMO6ijcd2jeCpnUpAKrlByEvAsBkmTekV45QwV2nFGNp4EIVitP96nq6F/r1nQRCeDLgWnTrbA6t/wDkcqlAcmf7EqRPctfewlrBNMdIowq6zerbkOJ5JLWqQuVopZQv+Gi1S4J8rwKzUSLJC841YQUrgEPIuXSgd2zmuA7gzKFO4/+SYA2JbQtdtkT8VGceMX1Q/wRSIWxXZ/gZQJOS+HFjKHzWMyAq5Na84uM6i9wCT+SOc1y0SxvhKxKAOfsVj1I/uSPo1jE2vGlVJjpSqLpnINhUWtJDdF2RIZD3XON3wCqLHSPqJw== X-YMail-OSG: RFVvW7gVM1nPfcX_6gh1zZwE6SOoMrbjP2.cFsSaIugkXWDyYclJFnzVM2QdVFx mQUNCKkUkI_0es1GnY5wGoK.y_fpFQ5.zvgi4U353YNjcds05suhuuJEnQtH24PJuEgjC68LdrOn RaixQp9kw7Z.R8KTYV4wysCjfIWsP3Cj8URwl0nS3QXv4VMXvSK84PakNjKkwU88EIBpVuDIzbPe fETucdnyM0h3zTcNJC1PhFnQXG7KivNc5Lr.AmlDOWkXBYNdlxH71kH7W.9.kxTP2MjIVvUfZY8H zbIZ9PL3sSs8cw1t56DE.w5a1RhPm6Y3ZPm2rPkhmy25J32W8OfkyNQwqPaKmphfJ33_NZaafGCQ 02xKHEEGalKK.2DNUpocfwZG0.wGoUqyq2lsT6_58Cobe0W.IuJS_0R3CAd5Uso_X6nZ98bfQdN6 g5muth3v6XpLcDdZOqP.KK.r92z9RG2WVn1blWKJ5DQ_JFqmPRoIqYfFGgsPNAyAeAqHaGHOV2GS ePas3zxR3sG1Tzx1puRl81lDBkSPZvMbeOiBSEfEQ.i0rzAOilBVcLnRYfc5I.joJx7gNf4GpkLF FkSKGYYcWwIn2TS0FkJDJdbwd8nlUoBXRSP_4GiWIh1ds9vCJg._ZeX8sMhFe_2VCGm59.YTc6Et UpA77FE5piLIFf9naqRTbQKblH4Vh41XnHrR_h2efl5mnknqQk4TB3RopbVAM22b9udDjjfBCQF7 EASPVoFSh.VUpDN4Hm7yCwlHKdPucEUzuhdvRhpS0YB3nFUMy0i_i42HqI2oLlxg6VD.ko174vSN dUc0W3OtYXF9NrHE6pkXx3CN_RyKjoHqFJQLcB65xQHLqlQyzHLNHwP0xmgg3cVxgfpMR59eDlkG hZx4MgBEMCu5awo..muN_oTP7lUAi2onaxBLN86t46sOg3Rmwa_J0MDJhaaskK.5W.cvsVkGq0aJ hNizigyigeMz5sIWlu.Z1b2k73pUERgaUEKn7fMQuV0iIYvgtKN.bauRW7kombOZku.DWWqarBY6 pO6roMoSzOr5stvTzDGvN_x1Z0HTdx_vbTH.kz5AhKv.m7yPJ17GeCdLLe3wXAAc- Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.bf2.yahoo.com with HTTP; Tue, 26 Feb 2019 14:11:36 +0000 Date: Tue, 26 Feb 2019 14:11:32 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: "gilberto.castillo@etecsa.cu" , Pgsql-admin Message-ID: <22207276.5485668.1551190292642@mail.yahoo.com> In-Reply-To: <0490872142b8c63b8fb4fae5e3d84de7@etecsa.cu> References: <1323549085.4899214.1551113430643.ref@mail.yahoo.com> <1323549085.4899214.1551113430643@mail.yahoo.com> <1114844707.4989150.1551120503721@mail.yahoo.com> <318302488.5021763.1551122196711@mail.yahoo.com> <0490872142b8c63b8fb4fae5e3d84de7@etecsa.cu> Subject: Re: [MASSMAIL]Re: pg_dumpall: could not connect to database: FATAL MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5485667_1271787231.1551190292625" X-Mailer: WebService/1.1.13123 YahooMailNeo Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36 Content-Length: 71075 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_5485667_1271787231.1551190292625 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable No sir.=C2=A0 =C2=A0I have tried what your suggestion and still failed. as root: # export HOSTNAME=3D"localhost"# export USERNAME=3D"postgres"# export DATAB= ASE=3D"postgres"# pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" > /= tmp/postresp.sql pg_dump:[archiver (db)] connection to database "DATABASE" failed: FATAL: Id= ent authentication failed for user "postgres" # export HOSTNAME=3D"127.0.0.1"# export USERNAME=3D"postgres"# export DATAB= ASE=3D"postgres"# pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" > /= tmp/postresp.sql pg_dump:[archiver (db)] connection to database "DATABASE" failed: FATAL: Id= ent authentication failed for user "postgres" as same as postgres: #su - postgres =C2=A0export HOSTNAME=3D"localhost"# export USERNAME=3D"postgres"# export D= ATABASE=3D"postgres"# pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE"= > /tmp/postresp.sql pg_dump:[archiver (db)] connection to database "DATABASE" failed: FATAL: Id= ent authentication failed for user "postgres" # export HOSTNAME=3D"127.0.0.1"# export USERNAME=3D"postgres"# export DATAB= ASE=3D"postgres"# pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" > /= tmp/postresp.sql pg_dump:[archiver (db)] connection to database "DATABASE" failed: FATAL: Id= ent authentication failed for user "postgres" as the postgres, I can run pgdump dbname > output.sql v/r,=C2=A0Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love and forgive more.To call= him a dog hardly seems to do him justice though in as much as he had four = legs, a tail, and barked, I admit he was, to all outward appearances. But t= o those who knew him well, he was a perfect gentleman (Hermione Gingold) **Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely = rich *** Faithful talent *** Sharing success=20 On Monday, February 25, 2019 2:39 PM, "gilberto.castillo@etecsa.cu" wrote: =20 El 2019-02-25 14:16, Pepe TD Vo escribi=C3=B3: > I am running script in local host (same db server) El 2019-02-25 14:16, Pepe TD Vo escribi=C3=B3: > I am running script in local host (same db server) Please, Check this: root@gilbertoc:/home/gilbertoc# export HOSTNAME=3D"localhost";=20 USERNAME=3D"postgres"; DATABASE=3D"postgres" root@gilbertoc:/home/gilbertoc# pg_dump -Fc -h "$HOSTNAME" -U=20 "$USERNAME" "$DATABASE" > /tmp/postresp.sql Password: pg_dump: [archiver (db)] connection to database "postgres" failed:=20 FATAL:=C2=A0 password authentication failed for user "postgres" FATAL:=C2=A0 password authentication failed for user "postgres" Other: root@gilbertoc:/home/gilbertoc# sudo su - postgres postgres@gilbertoc:~$ export HOSTNAME=3D"localhost"; USERNAME=3D"postgres";= =20 DATABASE=3D"postgres" postgres@gilbertoc:~$ pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME"=20 "$DATABASE" > /tmp/postresp.sql =C2=A0 /tmp/postresp.sql: Permiso denegado Fine: postgres@gilbertoc:~$ export HOSTNAME=3D"127.0.0.1"; USERNAME=3D"postgres";= =20 DATABASE=3D"postgres" postgres@gilbertoc:~$ pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME"=20 "$DATABASE" > /tmp/salvapostgres.backup postgres@gilbertoc:~$ ls /tmp/salvapostgres.backup /tmp/salvapostgres.backup >=20 > Bach-Nga >=20 > No one in this world is pure and perfect.=C2=A0 If you avoid people for > their mistakes you will be alone. So judge less, love and forgive > more. > To call him a dog hardly seems to do him justice though in as much as > he had four legs, a tail, and barked, I admit he was, to all outward > appearances. But to those who knew him well, he was a perfect > gentleman (Hermione Gingold) > **Live simply **Love generously **Care deeply **Speak kindly. > *** Genuinely rich *** Faithful talent *** Sharing success >=20 >=C2=A0 On Monday, February 25, 2019 1:58 PM, "gilberto.castillo@etecsa.cu" > wrote: >=20 > El 2019-02-25 13:48, Pepe TD Vo escribi=C3=B3: >=20 >> Thank you for your information. >=20 >> I saw this document this morning and I did check my pg_hba.conf and >=20 >> for local host and tried to connect to the template1/0 and/or other >=20 >> database with postgres fine without prompting me for the password >=20 >>=20 >=20 >> #psql -d template0 -U postgres >=20 >> template0-# >=20 >> #psql -d template1 -U postgres >=20 >> template1-# >=20 >>=20 >=20 >> #psql -d CIDR -U postgres >=20 >> CIDR-# >=20 >> #psql -d postgres -U postgres >=20 >> postgres-# >=20 >>=20 >=20 >> and a pg_hba.conf: >=20 >>=20 >=20 >> " >=20 >>=20 >=20 >> #TYPE=C2=A0 DATABASE=C2=A0 =C2=A0 USER=C2=A0 =C2=A0 ADDRESS=C2=A0 =C2=A0= METHOD >=20 >> local=C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 trust >=20 >> host=C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 127.0.0.1/32 trust >=20 >> host=C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 ::1/128=C2=A0 =C2=A0 =C2=A0 =C2=A0 tr= ust >=20 > Look here the IP only connect to localhost. From where Are your > running >=20 > the script? >=20 >> #allo replication connections from localhost, by a user with the >=20 >> replication privilege >=20 >> local=C2=A0 =C2=A0 replication=C2=A0 =C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 trust >=20 >> host=C2=A0 =C2=A0 replication=C2=A0 =C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 127..0.1/32=C2=A0 trust >=20 >> host=C2=A0 =C2=A0 replication=C2=A0 =C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 ::1/128=C2=A0 =C2=A0 =C2=A0 =C2=A0 trust >=20 >>=20 >=20 >> the problem is I'm not sure I need to reconfigure pg_hba.conf with >=20 >> database with user postgres or not? >=20 >>=20 >=20 >> When I'm connecting into the each database and the "show > pg_hba.conf" >=20 >> show nothing. >=20 >>=20 >=20 >> postgres-# show pg_hba.conf >=20 >> postgres-# >=20 >>=20 >=20 >> Bach-Nga >=20 >>=20 >=20 >> No one in this world is pure and perfect.=C2=A0 If you avoid people for >=20 >> their mistakes you will be alone. So judge less, love and forgive >=20 >> more. >=20 >> To call him a dog hardly seems to do him justice though in as much > as >=20 >> he had four legs, a tail, and barked, I admit he was, to all outward >=20 >> appearances. But to those who knew him well, he was a perfect >=20 >> gentleman (Hermione Gingold) >=20 >> **Live simply **Love generously **Care deeply **Speak kindly. >=20 >> *** Genuinely rich *** Faithful talent *** Sharing success >=20 >>=20 >=20 >>=C2=A0 On Monday, February 25, 2019 12:28 PM, Shreeyansh Dba >=20 >> wrote: >=20 >>=20 >=20 >> Hi Pepe, >=20 >>=20 >=20 >> It seems your are using os user for taking the backup. >=20 >>=20 >=20 >> When you run command line commands against the postgres database and >=20 >> they ask for the user and password that is the database user > postgres >=20 >> and its associated password, so when you do something like: psql -d >=20 >> template1 -U postgres the password you will be prompted for is >=20 >> your_db_user password >=20 >>=20 >=20 >> Now the above also depends on what is set in pg_hba.conf for the >=20 >> various combinations of host, database, user and auth_method. >=20 >>=20 >=20 >> For more information see >=20 >>=20 > https://www.postgresql.org/docs/9.5/static/client-authentication.html >=20 >>=20 >=20 >> Thanks & Regards, >=20 >> SHREEYANSH DBA TEAM >=20 >> www.shreeyansh.com [1] >=20 >>=20 >=20 >> On Mon, Feb 25, 2019 at 10:21 PM Pepe TD Vo > wrote: >=20 >>=20 >=20 >>> good morning Expert DBAs, >=20 >>>=20 >=20 >>> I created a script to do backup and I have faced the error of >=20 >>>=20 >=20 >>>> Performing globals backup: >=20 >>>> pg_dumpall: could not connect to database "template1":FATAL: Ident >=20 >>>> authentication failed for user "postgres" fro globals backup.=C2=A0 As >=20 >>>> same as performing schema-only backups and full backup. >=20 >>>>=20 >=20 >>>> Performing schema-only backup: >=20 >>>> psql:FATAL: Ident authentication failed for user "postgres" >=20 >>>> the following databases were matched for schema-only backup: >=20 >>>>=20 >=20 >>>> performing full backup: >=20 >>>> psql:FATAL: Ident authentication failed for user "postgres" >=20 >>>=20 >=20 >>> I can run pg_dumpall > postgresdump.sql as postgres user os but >=20 >>> couldn't run from script even the script declared >=20 >>> BACKUP_USER=3Dpostgres >=20 >>>=20 >=20 >>> If I take the syntax, -H "$HOSTNAME" -U "$USERNAME" out and the >=20 >>> backup script working fine >=20 >>>=20 >=20 >>> # VI PG_BACKUP.CONFIG >=20 >>>=20 >=20 >>> ############################## >=20 >>> ## POSTGRESQL BACKUP CONFIG ## >=20 >>> ############################## >=20 >>>=20 >=20 >>> # Optional system user to run backups as.=C2=A0 If the user the script > is >=20 >>> running as doesn't match this >=20 >>> # the script terminates.=C2=A0 Leave blank to skip check. >=20 >>> BACKUP_USER=3D >=20 >>>=20 >=20 >>> # Optional hostname to adhere to pg_hba policies.=C2=A0 Will default to >=20 >>> "localhost" if none specified. >=20 >>> HOSTNAME=3D"hostname" >=20 >>>=20 >=20 >>> # Optional username to connect to database as.=C2=A0 Will default to >=20 >>> "postgres" if none specified. >=20 >>> USERNAME=3D"postgres" >=20 >>>=20 >=20 >>> # This dir will be created if it doesn't exist.=C2=A0 This must be >=20 >>> writable by the user the script is >=20 >>> # running as. >=20 >>> BACKUP_DIR=3D/home/backups/database/postgresql/ >=20 >>>=20 >=20 >>> # List of strings to match against in database name, separated by >=20 >>> space or comma, for which we only >=20 >>> # wish to keep a backup of the schema, not the data. Any database >=20 >>> names which contain any of these >=20 >>> # values will be considered candidates. (e.g. "system_log" will >=20 >>> match "dev_system_log_2010-01") >=20 >>> SCHEMA_ONLY_LIST=3D"" >=20 >>>=20 >=20 >>> # Will produce a custom-format backup if set to "yes" >=20 >>> ENABLE_CUSTOM_BACKUPS=3Dyes >=20 >>>=20 >=20 >>> # Will produce a gzipped plain-format backup if set to "yes" >=20 >>> ENABLE_PLAIN_BACKUPS=3Dyes >=20 >>>=20 >=20 >>> # Will produce gzipped sql file containing the cluster globals, > like >=20 >>> users and passwords, if set to "yes" >=20 >>> ENABLE_GLOBALS_BACKUPS=3Dyes >=20 >>>=20 >=20 >>> #### SETTINGS FOR ROTATED BACKUPS #### >=20 >>>=20 >=20 >>> # Which day to take the weekly backup from (1-7 =3D Monday-Sunday) >=20 >>> DAY_OF_WEEK_TO_KEEP=3D5 >=20 >>>=20 >=20 >>> # Number of days to keep daily backups >=20 >>> DAYS_TO_KEEP=3D7 >=20 >>>=20 >=20 >>> # How many weeks to keep weekly backups >=20 >>> WEEKS_TO_KEEP=3D5 >=20 >>>=20 >=20 >>> ###################################### >=20 >>>=20 >=20 >>> #VI PG_BACKUP.SH >=20 >>>=20 >=20 >>> #!/bin/bash >=20 >>>=20 >=20 >>> ########################### >=20 >>> ####### LOAD CONFIG ####### >=20 >>> ########################### >=20 >>>=20 >=20 >>> while [ $# -gt 0 ]; do >=20 >>> case $1 in >=20 >>> -c) >=20 >>> if [ -r "$2" ]; then >=20 >>> source "$2" >=20 >>> shift 2 >=20 >>> else >=20 >>> ${ECHO} "Unreadable config file >=20 >>> \"$2\"" 1>&2 >=20 >>> exit 1 >=20 >>> fi >=20 >>> ;; >=20 >>> *) >=20 >>> ${ECHO} "Unknown Option \"$1\"" 1>&2 >=20 >>> exit 2 >=20 >>> ;; >=20 >>> esac >=20 >>> done >=20 >>>=20 >=20 >>> if [ $# =3D 0 ]; then >=20 >>> SCRIPTPATH=3D$(cd ${0%/*} && pwd -P) >=20 >>> source $SCRIPTPATH/pg_backup.config >=20 >>> fi; >=20 >>>=20 >=20 >>> ########################### >=20 >>> #### PRE-BACKUP CHECKS #### >=20 >>> ########################### >=20 >>>=20 >=20 >>> # Make sure we're running as the required backup user >=20 >>> if [ "$BACKUP_USER" !=3D "" -a "$(id -un)" !=3D "$BACKUP_USER" ]; then >=20 >>> echo "This script must be run as $BACKUP_USER. Exiting." 1>&2 >=20 >>> exit 1; >=20 >>> fi; >=20 >>>=20 >=20 >>> ########################### >=20 >>> ### INITIALISE DEFAULTS ### >=20 >>> ########################### >=20 >>>=20 >=20 >>> if [ ! $HOSTNAME ]; then >=20 >>> HOSTNAME=3D"localhost" >=20 >>> fi; >=20 >>>=20 >=20 >>> if [ ! $USERNAME ]; then >=20 >>> USERNAME=3D"postgres" >=20 >>> fi; >=20 >>>=20 >=20 >>> ########################### >=20 >>> #### START THE BACKUPS #### >=20 >>> ########################### >=20 >>>=20 >=20 >>> FINAL_BACKUP_DIR=3D$BACKUP_DIR"`date +\%Y-\%m-\%d`/" >=20 >>>=20 >=20 >>> echo "Making backup directory in $FINAL_BACKUP_DIR" >=20 >>>=20 >=20 >>> if ! mkdir -p $FINAL_BACKUP_DIR; then >=20 >>> echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go >=20 >>> and fix it!" 1>&2 >=20 >>> exit 1; >=20 >>> fi; >=20 >>>=20 >=20 >>> ####################### >=20 >>> ### GLOBALS BACKUPS ### >=20 >>> ####################### >=20 >>>=20 >=20 >>> echo -e "\n\nPerforming globals backup" >=20 >>> echo -e "--------------------------------------------\n" >=20 >>>=20 >=20 >>> if [ $ENABLE_GLOBALS_BACKUPS =3D "yes" ] >=20 >>> then >=20 >>> echo "Globals backup" >=20 >>>=20 >=20 >>> if ! pg_dumpall -g -h "$HOSTNAME" -U "$USERNAME" | gzip > >=20 >>> $FINAL_BACKUP_DIR"globals".sql.gz.in_progress; then >=20 >>> echo "[!!ERROR!!] Failed to produce globals backup" >=20 >>> 1>&2 >=20 >>> else >=20 >>> mv $FINAL_BACKUP_DIR"globals".sql.gz.in_progress >=20 >>> $FINAL_BACKUP_DIR"globals".sql.gz >=20 >>> fi >=20 >>> else >=20 >>> echo "None" >=20 >>> fi >=20 >>>=20 >=20 >>> ########################### >=20 >>> ### SCHEMA-ONLY BACKUPS ### >=20 >>> ########################### >=20 >>>=20 >=20 >>> for SCHEMA_ONLY_DB in ${SCHEMA_ONLY_LIST//,/ } >=20 >>> do >=20 >>> SCHEMA_ONLY_CLAUSE=3D"$SCHEMA_ONLY_CLAUSE or datname ~ >=20 >>> '$SCHEMA_ONLY_DB'" >=20 >>> done >=20 >>>=20 >=20 >>> SCHEMA_ONLY_QUERY=3D"select datname from pg_database where false >=20 >>> $SCHEMA_ONLY_CLAUSE order by datname;" >=20 >>>=20 >=20 >>> echo -e "\n\nPerforming schema-only backups" >=20 >>> echo -e "--------------------------------------------\n" >=20 >>>=20 >=20 >>> SCHEMA_ONLY_DB_LIST=3D`psql -h "$HOSTNAME" -U "$USERNAME" -At -c >=20 >>> "$SCHEMA_ONLY_QUERY" postgres` >=20 >>>=20 >=20 >>> echo -e "The following databases were matched for schema-only >=20 >>> backup:\n${SCHEMA_ONLY_DB_LIST}\n" >=20 >>>=20 >=20 >>> for DATABASE in $SCHEMA_ONLY_DB_LIST >=20 >>> do >=20 >>> echo "Schema-only backup of $DATABASE" >=20 >>>=20 >=20 >>> if ! pg_dump -Fp -s -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" | >=20 >>> gzip > $FINAL_BACKUP_DIR"$DATABASE"_SCHEMA.sql.gz.in_progress; then >=20 >>> echo "[!!ERROR!!] Failed to backup database schema of >=20 >>> $DATABASE" 1>&2 >=20 >>> else >=20 >>> mv $FINAL_BACKUP_DIR"$DATABASE"_SCHEMA.sql.gz.in_progress >=20 >>> $FINAL_BACKUP_DIR"$DATABASE"_SCHEMA.sql.gz >=20 >>> fi >=20 >>> done >=20 >>>=20 >=20 >>> ########################### >=20 >>> ###### FULL BACKUPS ####### >=20 >>> ########################### >=20 >>>=20 >=20 >>> for SCHEMA_ONLY_DB in ${SCHEMA_ONLY_LIST//,/ } >=20 >>> do >=20 >>> EXCLUDE_SCHEMA_ONLY_CLAUSE=3D"$EXCLUDE_SCHEMA_ONLY_CLAUSE and >=20 >>> datname !~ '$SCHEMA_ONLY_DB'" >=20 >>> done >=20 >>>=20 >=20 >>> FULL_BACKUP_QUERY=3D"select datname from pg_database where not >=20 >>> datistemplate and datallowconn $EXCLUDE_SCHEMA_ONLY_CLAUSE order by >=20 >>> datname;" >=20 >>>=20 >=20 >>> echo -e "\n\nPerforming full backups" >=20 >>> echo -e "--------------------------------------------\n" >=20 >>>=20 >=20 >>> for DATABASE in `psql -h "$HOSTNAME" -U "$USERNAME" -At -c >=20 >>> "$FULL_BACKUP_QUERY" postgres` >=20 >>> do >=20 >>> if [ $ENABLE_PLAIN_BACKUPS =3D "yes" ] >=20 >>> then >=20 >>> echo "Plain backup of $DATABASE" >=20 >>>=20 >=20 >>> if ! pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" | >=20 >>> gzip > $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress; then >=20 >>> echo "[!!ERROR!!] Failed to produce plain backup >=20 >>> database $DATABASE" 1>&2 >=20 >>> else >=20 >>> mv $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress >=20 >>> $FINAL_BACKUP_DIR"$DATABASE".sql.gz >=20 >>> fi >=20 >>> fi >=20 >>>=20 >=20 >>> if [ $ENABLE_CUSTOM_BACKUPS =3D "yes" ] >=20 >>> then >=20 >>> echo "Custom backup of $DATABASE" >=20 >>>=20 >=20 >>> if ! pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" >=20 >>> -f $FINAL_BACKUP_DIR"$DATABASE".custom.in_progress; then >=20 >>> echo "[!!ERROR!!] Failed to produce custom backup >=20 >>> database $DATABASE" 1>&2 >=20 >>> else >=20 >>> mv $FINAL_BACKUP_DIR"$DATABASE".custom.in_progress >=20 >>> $FINAL_BACKUP_DIR"$DATABASE".custom >=20 >>> fi >=20 >>> fi >=20 >>>=20 >=20 >>> done >=20 >>>=20 >=20 >>> echo -e "\nAll database backups complete!" >=20 >>>=20 >=20 >>> I'm appreciate if anyone know how to correct this? >=20 >>>=20 >=20 >>> thank you. >=20 >>>=20 >=20 >>> v/r, >=20 >>>=20 >=20 >>> Bach-Nga >=20 >>>=20 >=20 >>> No one in this world is pure and perfect.=C2=A0 If you avoid people for >=20 >>> their mistakes you will be alone. So judge less, love and forgive >=20 >>> more. >=20 >>> To call him a dog hardly seems to do him justice though in as much >=20 >>> as he had four legs, a tail, and barked, I admit he was, to all >=20 >>> outward appearances. But to those who knew him well, he was a >=20 >>> perfect gentleman (Hermione Gingold) >=20 >>> **Live simply **Love generously **Care deeply **Speak kindly. >=20 >>> *** Genuinely rich *** Faithful talent *** Sharing success >=20 >>=20 >=20 >>=20 >=20 >>=20 >=20 >> Links: >=20 >> ------ >=20 >> [1] http://www.shreeyansh.com/ =20 ------=_Part_5485667_1271787231.1551190292625 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
No sir.   I have tried what your suggestion and still = failed.

as root:

# export HOSTNAME= =3D"localhost"
# export USERNAME=3D"postgres"
# export DATABASE=3D"postgres"
# pg_dump -Fc -h "$HOSTNAME" -U "$US= ERNAME" "$DATABASE" > /tmp/postresp.sql

pg_dump:[archiver (db)] connection to database "DATABASE" fail= ed: FATAL: Ident authentication failed for user "postgres"

# export HOSTNAME=3D"127.0.0.= 1"
# export USERNAME=3D"postgres"
# expor= t DATABASE=3D"postgres"
# pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" > /t= mp/postresp.sql

pg_= dump:[archiver (db)] connection to database "DATABASE" failed: FATAL: Ident= authentication failed for user "postgres"


= as same as postgres:

#s= u - postgres

 export HOSTN= AME=3D"localhost"
# export USERNAME=3D"postgres"
# export DATABASE=3D"postgre= s"
# pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" > /tmp/postres= p.sql

pg_dump:[archiver (db)] connection to database "DATABASE" failed: = FATAL: Ident authentication failed for user "postgres"

# export HOSTNAME= =3D"127.0.0.1"
# export USERNAME=3D"postgres"
# export DATABASE=3D"postgres"<= /font>
#= pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" > /tmp/postresp.s= ql

pg_dump:[archiver (db)] connection to database "DATABASE" failed: FAT= AL: Ident authentication failed for user "postgres"


as the post= gres, I can run pgdump dbname > output.sql

v/r,
 
<= span class=3D"yiv3811552299sg">
Bach-Nga

No one in this world i= s pure and perfect.  If you avoid people for their mistakes you will b= e alone. So judge less, love and forgive more.
= To call him a dog hardly seems to do him justice though in as much as he ha= d four legs, a tail, and barked, I admit he was, to all outward appearances= . But to those who knew him well, he was a perfect gentleman (Hermione Ging= old)

**Live simply **= Love generously **Care deeply **Speak kindly.
*** Genuinely = rich *** Faithful talent *** Sharing success


On Monday, February 25, 2019 2:= 39 PM, "gilberto.castillo@etecsa.cu" <gilberto.castillo@etecsa.cu> wr= ote:


El 2019-02-25 14:16, Pepe TD Vo escribi=C3=B3:
> I am running script in local host (same db server)

El 2019-02-25 14:16, Pepe TD Vo escrib= i=C3=B3:
> I am running script in local host (= same db server)


Please, Check this:

root@gilbertoc:/home/gilbertoc# export HOSTNAME=3D"localhos= t";
USERNAME=3D"postgres"; DATABASE=3D"postgres"=

root@gilbertoc:/home/gil= bertoc# pg_dump -Fc -h "$HOSTNAME" -U
"$USERNAME= " "$DATABASE" > /tmp/postresp.sql
Password:
pg_dump: [archiver (db)] connection to database "po= stgres" failed:
FATAL:  password authentica= tion failed for user "postgres"
FATAL:  pass= word authentication failed for user "postgres"

Other:

root@gilbertoc:/home/gilbertoc# sudo su -= postgres

postgres@= gilbertoc:~$ export HOSTNAME=3D"localhost"; USERNAME=3D"postgres";
=
DATABASE=3D"postgres"

=
postgres@gilbertoc:~$ pg_dump -Fc -h "$HOSTNAME= " -U "$USERNAME"
"$DATABASE" > /tmp/postresp.= sql
  /tmp/postresp.sql: Permiso denegado


Fine:

postgres@gil= bertoc:~$ export HOSTNAME=3D"127.0.0.1"; USERNAME=3D"postgres";
DATABASE=3D"postgres"

postgres@gilbertoc:~$ pg_dump -Fc -h "$HOSTNAME" -= U "$USERNAME"
"$DATABASE" > /tmp/salvapostgre= s.backup
postgres@gilbertoc:~$ ls /tmp/salva= postgres.backup
/tmp/salvapostgres.backup


&g= t;
> Bach-Nga
> =
> No one in this world is pure and perfect.&n= bsp; If you avoid people for
> their mistakes = you will be alone. So judge less, love and forgive
> more.
> To call him a dog hardly seems = to do him justice though in as much as
> he ha= d four legs, a tail, and barked, I admit he was, to all outward
> appearances. But to those who knew him well, he was a p= erfect
> gentleman (Hermione Gingold)
> **Live simply **Love generously **Care deeply **Spea= k kindly.
> *** Genuinely rich *** Faithful ta= lent *** Sharing success
>
>  On Monday, February 25, 2019 1:58 PM, "gilberto.castillo@etecsa.cu"
>
> El 2019-02-25 13:48, Pepe TD = Vo escribi=C3=B3:
>
>> Thank you for your information.
>
>> I saw this document this morning and I di= d check my pg_hba.conf and
>
>> for local host and tried to connect to the template1/0 a= nd/or other
>
>&= gt; database with postgres fine without prompting me for the password
>
>>
>
>> #psql -d template0 -= U postgres
>
>&g= t; template0-#
>
&g= t;> #psql -d template1 -U postgres
>
>> template1-#
>
>>
>
>> #psql -d CIDR -U postgres
>
>> CIDR-#
>
>> #psql -d postgres -U postgres
>
>> postgres-= #
>
>>
>
>> and a pg_hba.= conf:
>
>>
>
>> "
>
>>
>
>> #TYPE  DATABASE&n= bsp;   USER    ADDRESS    METHOD
>
>> local    all&nb= sp;               all     = ;                     &nb= sp; trust
>
>>= ; host    all              &nb= sp; all        127.0.0.1/32 trust
>
>> host    all  &= nbsp;             all      &nb= sp; ::1/128        trust
>=
> Look here the IP only connect to localhost= . From where Are your
> running
>
> the script?
>
>> #allo replication conn= ections from localhost, by a user with the
> <= br>
>> replication privilege
>
>> local    replic= ation      all            &nbs= p;                 trust
<= div dir=3D"ltr">>
>> host    = replication      all          127..= 0.1/32  trust
>
>> host    replication      all  &nbs= p;       ::1/128        trust
<= div dir=3D"ltr">>
>>
>
>> the problem is I'm not su= re I need to reconfigure pg_hba.conf with
>
>> database with user postgres or not?
>
>>
>
>> When I'm connecting = into the each database and the "show
> pg_hba.= conf"
>
>> sh= ow nothing.
>
>&= gt;
>
>> pos= tgres-# show pg_hba.conf
>
>> postgres-#
>
>>
>
>> Bach-Nga
>
>>
>
&= gt;> No one in this world is pure and perfect.  If you avoid people= for
>
>> the= ir mistakes you will be alone. So judge less, love and forgive
>
>> more.
>
>> To call him a dog hard= ly seems to do him justice though in as much
>= as
>
>> he h= ad four legs, a tail, and barked, I admit he was, to all outward
<= div dir=3D"ltr">>
>> appearances. But t= o those who knew him well, he was a perfect
> =
>> gentleman (Hermione Gingold)
<= div dir=3D"ltr">>
>> **Live simply **Lo= ve generously **Care deeply **Speak kindly.
> =
>> *** Genuinely rich *** Faithful talent = *** Sharing success
>
>>
>
>= >  On Monday, February 25, 2019 12:28 PM, Shreeyansh Dba
<= div dir=3D"ltr">>
>
<= /div>
>>
>
>> Hi Pepe,
>
<= div dir=3D"ltr">>>
>
>> It seems your are using os user for taking the backup.
>
>>
=
>
>> When you run comm= and line commands against the postgres database and
>
>> they ask for the user and passw= ord that is the database user
> postgres
>
>> and its assoc= iated password, so when you do something like: psql -d
>
>> template1 -U postgres the pa= ssword you will be prompted for is
>
>> your_db_user password
= >
>>
>
>> Now the above also depends on what is set= in pg_hba.conf for the
>
>> various combinations of host, database, user and auth_met= hod.
>
>>
>
>> For more i= nformation see
>
&g= t;>
>
>>
>
>> Thanks & Regards,
=
>
>> SHREEYANSH = DBA TEAM
>
>>= www.shreeyansh.com [1]
>
>>
>
>> On Mon, Feb 25, 2019 at 10:21 PM Pepe TD Vo <pepevo@yahoo.com>
>
>>> good morning Expert DBAs,
>
>>>
>
>>> I created a script to= do backup and I have faced the error of
>
>>>
>
>>>> Performing globals backup:
<= div dir=3D"ltr">>
>>>> pg_dumpall= : could not connect to database "template1":FATAL: Ident
>
>>>> authentication fa= iled for user "postgres" fro globals backup.  As
>
>>>> same as performing sc= hema-only backups and full backup.
>
>>>>
>
>>>> Performing schema-only backup:
>
>>>> psql:FAT= AL: Ident authentication failed for user "postgres"
>
>>>> the following databases= were matched for schema-only backup:
>
>>>>
>
<= /div>
>>>> performing full backup:
>
>>>> psql:FATAL: = Ident authentication failed for user "postgres"
&= gt;
>>>
>=
>>> I can run pg_dumpall > postgres= dump.sql as postgres user os but
>
<= div dir=3D"ltr">>>> couldn't run from script even the script decla= red
>
>>> = BACKUP_USER=3Dpostgres
>
>>>
>
>>> If I take the syntax, -H "$HOSTNAME" -U "$USERNAME" out and= the
>
>>>= backup script working fine
>
>>>
>
>>> # VI PG_BACKUP.CONFIG
> =
>>>
>
>>> ##############################
>
>>> ## POSTGRES= QL BACKUP CONFIG ##
>
>>> ##############################
&g= t;
>>>
> =
>>> # Optional system user to run backu= ps as.  If the user the script
> is
>
>>> running a= s doesn't match this
>
>>> # the script terminates.  Leave blank to skip check.<= br>
>
>>> BACK= UP_USER=3D
>
>&g= t;>
>
>>&= gt; # Optional hostname to adhere to pg_hba policies.  Will default to=
>
>>> "lo= calhost" if none specified.
>
>>> HOSTNAME=3D"hostname"
>= ;
>>>
> <= br>
>>> # Optional username to connect to da= tabase as.  Will default to
>
<= div dir=3D"ltr">>>> "postgres" if none specified.
>
>>> USERNAME=3D"postgres= "
>
>>>
>
>>> # Thi= s dir will be created if it doesn't exist.  This must be
>
>>> writable by the u= ser the script is
>
>>> # running as.
>
>>> BACKUP_DIR=3D/home/backups/database/postgresql/
=
>
>>>
>
>>> # List of = strings to match against in database name, separated by
>
>>> space or comma, for w= hich we only
>
>= >> # wish to keep a backup of the schema, not the data. Any database<= br>
>
>>> name= s which contain any of these
>
>>> # values will be considered candidates. (e.g. "sys= tem_log" will
>
>= ;>> match "dev_system_log_2010-01")
>
>>> SCHEMA_ONLY_LIST=3D""
>
>>>
>
>>> # Will produce a cust= om-format backup if set to "yes"
>
<= div dir=3D"ltr">>>> ENABLE_CUSTOM_BACKUPS=3Dyes
>
>>>
>
>>> # Will produce a gzipped= plain-format backup if set to "yes"
>
>>> ENABLE_PLAIN_BACKUPS=3Dyes
>
>>>
>
>>> # Will produce gzippe= d sql file containing the cluster globals,
> l= ike
>
>>> = users and passwords, if set to "yes"
>
>>> ENABLE_GLOBALS_BACKUPS=3Dyes
>
>>>
>
>>> #### SETTINGS FOR RO= TATED BACKUPS ####
>
>>>
>
&= gt;>> # Which day to take the weekly backup from (1-7 =3D Monday-Sund= ay)
>
>>> = DAY_OF_WEEK_TO_KEEP=3D5
>
>>>
>
>>> # Number of days to keep daily backups
>
>>> DAYS_TO_KEEP=3D7
<= /div>
>
>>>
>
>>> # How many = weeks to keep weekly backups
>
>>> WEEKS_TO_KEEP=3D5
> <= br>
>>>
>
=
>>> ######################################<= br>
>
>>>
=
>
>>> #VI PG_= BACKUP.SH
>
>>= ;>
>
>>&g= t; #!/bin/bash
>
&g= t;>>
>
>&= gt;> ###########################
>
>>> ####### LOAD CONFIG #######
>
>>> ###################= ########
>
>>= >
>
>>>= ; while [ $# -gt 0 ]; do
>
>>> case $1 in
>
<= div dir=3D"ltr">>>> -c)
>
<= div dir=3D"ltr">>>> if [ -r "$2" ]; then
>
>>> source "$2"
>
>>> shift 2
>
>>> else
>
>>> ${ECHO} "Unreada= ble config file
>
&= gt;>> \"$2\"" 1>&2
>
>>> exit 1
>
>>> fi
>
=
>>> ;;
>
<= div dir=3D"ltr">>>> *)
>
>>> ${ECHO} "Unknown Option \"$1\"" 1>&2
=
>
>>> exit 2<= br>
>
>>> ;;
>
>>> esac<= br>
>
>>> done=
>
>>>
>
>>> if [ $= # =3D 0 ]; then
>
&= gt;>> SCRIPTPATH=3D$(cd ${0%/*} && pwd -P)
>
>>> source $SCRIPTPATH/pg= _backup.config
>
&g= t;>> fi;
>
&g= t;>>
>
>&= gt;> ###########################
>
>>> #### PRE-BACKUP CHECKS ####
>
>>> ###################= ########
>
>>= >
>
>>>= ; # Make sure we're running as the required backup user
>
>>> if [ "$BACKUP_USER" != =3D "" -a "$(id -un)" !=3D "$BACKUP_USER" ]; then
>
>>> echo "This script must be run= as $BACKUP_USER. Exiting." 1>&2
>
=
>>> exit 1;
> =
>>> fi;
> =
>>>
>
>>> ###########################
<= div dir=3D"ltr">>
>>> ### INITIALISE= DEFAULTS ###
>
>= ;>> ###########################
>
>>>
>
>>> if [ ! $HOSTNAME ]; then
>
>>> HOSTNAME=3D"localhost= "
>
>>> fi= ;
>
>>>
>
>>> if [ = ! $USERNAME ]; then
>
>>> USERNAME=3D"postgres"
>
>>> fi;
>
>>>
>
>>> ###########################
>
>>> #### START THE BACKU= PS ####
>
>>&= gt; ###########################
>
>>>
>
>>> FINAL_BACKUP_DIR=3D$BACKUP_DIR"`date +\%Y-\%m-\%d`= /"
>
>>> <= br>
>
>>> echo= "Making backup directory in $FINAL_BACKUP_DIR"
&= gt;
>>>
>=
>>> if ! mkdir -p $FINAL_BACKUP_DIR; t= hen
>
>>> = echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go
>
>>> and fix it!" 1>= ;&2
>
>>&= gt; exit 1;
>
>&= gt;> fi;
>
>&= gt;>
>
>>= > #######################
>
>>> ### GLOBALS BACKUPS ###
= >
>>> #######################
>
>>>
=
>
>>> echo -e "\n\n= Performing globals backup"
>
>>> echo -e "-------------------------------------------= -\n"
>
>>>=
>
>>> if= [ $ENABLE_GLOBALS_BACKUPS =3D "yes" ]
>
<= /div>
>>> then
>
=
>>> echo "Globals backup"
>
>>>
>
>>> if ! pg_dumpall -g -h "$= HOSTNAME" -U "$USERNAME" | gzip >
>
>>> $FINAL_BACKUP_DIR"globals".sql.gz.in_progr= ess; then
>
>>= ;> echo "[!!ERROR!!] Failed to produce globals backup"
>
>>> 1>&2
=
>
>>> else
>
>>> mv $FINAL_BA= CKUP_DIR"globals".sql.gz.in_progress
>
>>> $FINAL_BACKUP_DIR"globals".sql.gz
>
>>> fi
=
>
>>> else
>
>>> echo "None"<= br>
>
>>> fi
>
>>>
<= /div>
>
>>> ########= ###################
>
>>> ### SCHEMA-ONLY BACKUPS ###
> =
>>> ###########################
>
>>>
<= div dir=3D"ltr">>
>>> for SCHEMA_ONL= Y_DB in ${SCHEMA_ONLY_LIST//,/ }
>
<= div dir=3D"ltr">>>> do
>
>>> SCHEMA_ONLY_CLAUSE=3D"$SCHEMA_ONLY_CLAUSE or da= tname ~
>
>>&= gt; '$SCHEMA_ONLY_DB'"
>
>>> done
>
>>>
>
>>> SCHEMA_ONLY_QUERY=3D"select datname from pg_database whe= re false
>
>>= > $SCHEMA_ONLY_CLAUSE order by datname;"
> =
>>>
>
>>> echo -e "\n\nPerforming schema-only ba= ckups"
>
>>&g= t; echo -e "--------------------------------------------\n"
>
>>>
>
>>> SCHEMA_ONLY_DB_LIST= =3D`psql -h "$HOSTNAME" -U "$USERNAME" -At -c
>= ;
>>> "$SCHEMA_ONLY_QUERY" postgres`
>
>>>
>
>>> echo -e "= The following databases were matched for schema-only
>
>>> backup:\n${SCHEMA_ONLY_DB_= LIST}\n"
>
>>= >
>
>>>= ; for DATABASE in $SCHEMA_ONLY_DB_LIST
>
<= /div>
>>> do
>
>>> echo "Schema-only backup of $DATABASE"
>
>>>
>
>>> if ! pg_d= ump -Fp -s -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" |
>
>>> gzip > $FINAL_BACKUP_= DIR"$DATABASE"_SCHEMA.sql.gz.in_progress; then
&g= t;
>>> echo "[!!ERROR!!] Failed to back= up database schema of
>
>>> $DATABASE" 1>&2
>
>>> else
>
>>> mv $FINAL_BACKUP_DIR"$DATABASE"_SCHEM= A.sql.gz.in_progress
>
>>> $FINAL_BACKUP_DIR"$DATABASE"_SCHEMA.sql.gz
>
>>> fi
>
>>> done
>
>>>
>
>>> #####################= ######
>
>>&g= t; ###### FULL BACKUPS #######
>
>>> ###########################
>
>>>
>
>>> for SCHEMA_ONLY_DB in ${SCH= EMA_ONLY_LIST//,/ }
>
>>> do
>
>>> EXCLUDE_SCHEMA_ONLY_CLAUSE=3D"$EXCLUDE_SCHEMA_ONLY_CLAUSE an= d
>
>>> da= tname !~ '$SCHEMA_ONLY_DB'"
>
>>> done
>
>>>
>
>>> FULL_BACKUP_QUERY=3D"select datname from pg_database = where not
>
>>= ;> datistemplate and datallowconn $EXCLUDE_SCHEMA_ONLY_CLAUSE order by
>
>>> datna= me;"
>
>>>=
>
>>> ec= ho -e "\n\nPerforming full backups"
>
>>> echo -e "----------------------------------= ----------\n"
>
>= ;>>
>
>&g= t;> for DATABASE in `psql -h "$HOSTNAME" -U "$USERNAME" -At -c
=
>
>>> "$FULL_BACKUP= _QUERY" postgres`
>
>>> do
>
= >>> if [ $ENABLE_PLAIN_BACKUPS =3D "yes" ]
>
>>> then
>
>>> echo "Plain backup of $DAT= ABASE"
>
>>&g= t;
>
>>> = if ! pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" |
>
>>> gzip > $FINAL_B= ACKUP_DIR"$DATABASE".sql.gz.in_progress; then
>= ;
>>> echo "[!!ERROR!!] Failed to produ= ce plain backup
>
&= gt;>> database $DATABASE" 1>&2
> =
>>> else
>=
>>> mv $FINAL_BACKUP_DIR"$DATABASE".sq= l.gz.in_progress
>
= >>> $FINAL_BACKUP_DIR"$DATABASE".sql.gz
= >
>>> fi
&= gt;
>>> fi
&g= t;
>>>
> =
>>> if [ $ENABLE_CUSTOM_BACKUPS =3D "ye= s" ]
>
>>>= then
>
>>>= ; echo "Custom backup of $DATABASE"
>
>>>
>
<= div dir=3D"ltr">>>> if ! pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME"= "$DATABASE"
>
>= >> -f $FINAL_BACKUP_DIR"$DATABASE".custom.in_progress; then
=
>
>>> echo "[!!ERRO= R!!] Failed to produce custom backup
>
>>> database $DATABASE" 1>&2
<= div dir=3D"ltr">>
>>> else
=
>
>>> mv $FINAL_BAC= KUP_DIR"$DATABASE".custom.in_progress
>
>>> $FINAL_BACKUP_DIR"$DATABASE".custom
>
>>> fi
>
>>> fi
>
>>>
<= div dir=3D"ltr">>
>>> done
=
>
>>>
>
>>> echo -e "\nAll d= atabase backups complete!"
>
>>>
>
>>> I'm appreciate if anyone know how to correct this?
>
>>>
>
>>> thank you= .
>
>>>
>
>>> v/r,<= br>
>
>>>
=
>
>>> Bach-Ng= a
>
>>>
>
>>> No on= e in this world is pure and perfect.  If you avoid people for
>
>>> their mistak= es you will be alone. So judge less, love and forgive
>
>>> more.
>
>>> To call him a dog har= dly seems to do him justice though in as much
>= ;
>>> as he had four legs, a tail, and = barked, I admit he was, to all
>
>>> outward appearances. But to those who knew him w= ell, he was a
>
>= ;>> perfect gentleman (Hermione Gingold)
&g= t;
>>> **Live simply **Love generously = **Care deeply **Speak kindly.
>
>>> *** Genuinely rich *** Faithful talent *** Sharin= g success
>
>>= ;
>
>>
<= /div>
>
>>
>
>> Links:
>
>> ------
>
------=_Part_5485667_1271787231.1551190292625--