From ganesh@magnusquest.com Thu Oct 16 01:37:29 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 164A3D1B50D for ; Thu, 16 Oct 2003 01:37:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 86992-02 for ; Wed, 15 Oct 2003 22:37:01 -0300 (ADT) Received: from mqsporttec.com (evilgods.net [128.121.126.6]) by svr1.postgresql.org (Postfix) with ESMTP id E8BC8D1B53F for ; Wed, 15 Oct 2003 22:36:55 -0300 (ADT) Received: from ganesan ([219.93.76.2]) by mqsporttec.com (8.12.10/8.11.6) with ESMTP id h9G1avcq034051 for ; Thu, 16 Oct 2003 09:36:58 +0800 (MYT) From: "Ganesan Kanavathy" To: Subject: pg_dump.. auto backup Date: Thu, 16 Oct 2003 09:36:29 +0800 Message-ID: <000001c39385$f0491280$1300a8c0@headquarters.mq.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01C393C8.FE6C5280" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.6 tagged_above=0.0 required=5.0 tests=HTML_80_90, RCVD_IN_RFCI X-Spam-Level: * X-Archive-Number: 200310/164 X-Sequence-Number: 10725 This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C393C8.FE6C5280 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I am doing a cronjob to dump pg database everyday. Below is my script for cronjob. #!/bin/sh /usr/local/pgsql/bin/pg_dump -U ganesh --no-owner -d mq > /backupdb/mq.dump cd / cd /backupdb/ tar -czf /backupdb/mq-`date '+%d-%m-%Y'`.tar.gz -R * This cronjob is schedule to run everyday at 3.30am. The problem I am facing is the when running the cronjob it is asking for password. If I remove -U ganesh, it is still prompting for password but this time root password. How do I solve this, when running the pg_dump I don't want it to prompt for password. Regards, ganesh ------=_NextPart_000_0001_01C393C8.FE6C5280 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I am doing a cronjob to dump= pg database everyday.

 

Below is my script for cronjob.

 

#!/bi= n/sh

 

/usr/local/pgsql/bin/pg_d= ump -U ganesh --no-owner -d mq= > /backupdb/mq.dump=

 

cd /=

cd /= backupdb/

 

tar  -czf /backupdb/mq-`date '= +%d-%m-%Y'`.tar.gz -R *

 

This cronjob is schedule to = run everyday at 3.30am.<= o:p>

 

The problem I am facing is the when running the cronjob it is asking for password. If I remove –U ganesh, it is still= prompting for password but this time root password.

 

How do I solve this, when running the pg_dump<= /span> I don’t want it to prompt for password.

 

Regards,

ganesh

 

 

------=_NextPart_000_0001_01C393C8.FE6C5280-- From rudi@oasis.net.au Thu Oct 16 01:59:22 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B93F6D1B547 for ; Thu, 16 Oct 2003 01:59:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 89126-06 for ; Wed, 15 Oct 2003 22:58:55 -0300 (ADT) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by svr1.postgresql.org (Postfix) with ESMTP id 13C47D1B533 for ; Wed, 15 Oct 2003 22:58:49 -0300 (ADT) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id MAA16478; Thu, 16 Oct 2003 12:27:45 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3F8DFCC9.5090603@oasis.net.au> Date: Thu, 16 Oct 2003 12:04:57 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ganesan Kanavathy Cc: pgsql-admin@postgresql.org Subject: Re: pg_dump.. auto backup References: <000001c39385$f0491280$1300a8c0@headquarters.mq.com> In-Reply-To: <000001c39385$f0491280$1300a8c0@headquarters.mq.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/165 X-Sequence-Number: 10726 Ganesan Kanavathy wrote: > I am doing a cronjob to dump pg database everyday. > > Below is my script for cronjob. > > #!/bin/sh > > */usr/local/pgsql/bin/pg_dump -U ganesh --no-owner -d mq > > /backupdb/mq.dump* > > cd / > > cd /backupdb/ > > tar -czf /backupdb/mq-`date '+%d-%m-%Y'`.tar.gz -R * > > This cronjob is schedule to run everyday at 3.30am. > > The problem I am facing is the when running the cronjob it is asking > for password. If I remove *–U ganesh*, it is still prompting for > password but this time root password. > > */How do I solve this, when running the pg_dump I don’t want it to > prompt for password./* > > Regards, > > ganesh > Hi, Just add: export PGPASSWORD=mypassword to your script. Be careful - this is like leaving the key under your house key under the mat. Regards Rudi. From ganesh@magnusquest.com Thu Oct 16 03:22:19 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0F40DD1B4E6 for ; Thu, 16 Oct 2003 03:22:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09258-05 for ; Thu, 16 Oct 2003 00:21:48 -0300 (ADT) Received: from mqsporttec.com (evilgods.net [128.121.126.6]) by svr1.postgresql.org (Postfix) with ESMTP id C583DD1B500 for ; Thu, 16 Oct 2003 00:21:47 -0300 (ADT) Received: from ganesan ([219.93.76.2]) by mqsporttec.com (8.12.10/8.11.6) with ESMTP id h9G3LeA7053866; Thu, 16 Oct 2003 11:21:41 +0800 (MYT) From: "Ganesan Kanavathy" To: "'Rudi Starcevic'" Cc: Subject: Re: pg_dump.. auto backup Date: Thu, 16 Oct 2003 11:21:14 +0800 Message-ID: <001301c39394$92c4a6b0$1300a8c0@headquarters.mq.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 In-Reply-To: <3F8DFCC9.5090603@oasis.net.au> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/166 X-Sequence-Number: 10727 Thanks Rudi, If possible I always prefer not to hard code any password in my script. Regards, ganesh -----Original Message----- From: Rudi Starcevic [mailto:rudi@oasis.net.au] Sent: Thursday, October 16, 2003 10:05 AM To: Ganesan Kanavathy Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] pg_dump.. auto backup Ganesan Kanavathy wrote: > I am doing a cronjob to dump pg database everyday. > > Below is my script for cronjob. > > #!/bin/sh > > */usr/local/pgsql/bin/pg_dump -U ganesh --no-owner -d mq > > /backupdb/mq.dump* > > cd / > > cd /backupdb/ > > tar -czf /backupdb/mq-`date '+%d-%m-%Y'`.tar.gz -R * > > This cronjob is schedule to run everyday at 3.30am. > > The problem I am facing is the when running the cronjob it is asking > for password. If I remove *-U ganesh*, it is still prompting for > password but this time root password. > > */How do I solve this, when running the pg_dump I don't want it to > prompt for password./* > > Regards, > > ganesh > Hi, Just add: export PGPASSWORD=mypassword to your script. Be careful - this is like leaving the key under your house key under the mat. Regards Rudi. From tgl@sss.pgh.pa.us Thu Oct 16 03:37:20 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 44B8BD1B4F2 for ; Thu, 16 Oct 2003 03:37:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10710-04 for ; Thu, 16 Oct 2003 00:36:49 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 71539D1B4E6 for ; Thu, 16 Oct 2003 00:36:48 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9G3aZuo015878; Wed, 15 Oct 2003 23:36:35 -0400 (EDT) To: Rudi Starcevic Cc: Ganesan Kanavathy , pgsql-admin@postgresql.org Subject: Re: pg_dump.. auto backup In-reply-to: <3F8DFCC9.5090603@oasis.net.au> References: <000001c39385$f0491280$1300a8c0@headquarters.mq.com> <3F8DFCC9.5090603@oasis.net.au> Comments: In-reply-to Rudi Starcevic message dated "Thu, 16 Oct 2003 12:04:57 +1000" Date: Wed, 15 Oct 2003 23:36:35 -0400 Message-ID: <15877.1066275395@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/167 X-Sequence-Number: 10728 Rudi Starcevic writes: > Ganesan Kanavathy wrote: >> The problem I am facing is the when running the cronjob it is asking >> for password. > Just add: > export PGPASSWORD=mypassword > to your script. A much better solution (assuming you are using a reasonably recent PG release) is to put the needed password in ~/.pgpass, which can be set to 0600 permissions. PGPASSWORD is insecure on many platforms because other people can see your environment variables. regards, tom lane From ganesh@magnusquest.com Thu Oct 16 04:09:18 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 03B87D1B4E3 for ; Thu, 16 Oct 2003 04:09:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 13668-08 for ; Thu, 16 Oct 2003 01:08:46 -0300 (ADT) Received: from mqsporttec.com (evilgods.net [128.121.126.6]) by svr1.postgresql.org (Postfix) with ESMTP id C9556D1B500 for ; Thu, 16 Oct 2003 01:08:45 -0300 (ADT) Received: from ganesan ([219.93.76.2]) by mqsporttec.com (8.12.10/8.11.6) with ESMTP id h9G48d39070186; Thu, 16 Oct 2003 12:08:41 +0800 (MYT) From: "Ganesan Kanavathy" To: "'Tom Lane'" , "'Rudi Starcevic'" Cc: Subject: Re: pg_dump.. auto backup Date: Thu, 16 Oct 2003 12:08:11 +0800 Message-ID: <000e01c3939b$22aad1e0$1300a8c0@headquarters.mq.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal In-Reply-To: <15877.1066275395@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/168 X-Sequence-Number: 10729 Thanks for the reply, I don't really understand this. How to put password in ~/.pgpass. What changes do I need to do on the script? How do I access to the password to authenticate? I'm still new Linux. Hope to get more explanation and guidance. Thanks. Regards, ganesh -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Tom Lane Sent: Thursday, October 16, 2003 11:37 AM To: Rudi Starcevic Cc: Ganesan Kanavathy; pgsql-admin@postgresql.org Subject: Re: [ADMIN] pg_dump.. auto backup Rudi Starcevic writes: > Ganesan Kanavathy wrote: >> The problem I am facing is the when running the cronjob it is asking >> for password. > Just add: > export PGPASSWORD=mypassword > to your script. A much better solution (assuming you are using a reasonably recent PG release) is to put the needed password in ~/.pgpass, which can be set to 0600 permissions. PGPASSWORD is insecure on many platforms because other people can see your environment variables. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) From bhuvan@symonds.net Thu Oct 16 13:09:09 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4735CD1B518 for ; Thu, 16 Oct 2003 13:09:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 00676-03 for ; Thu, 16 Oct 2003 10:08:41 -0300 (ADT) Received: from Gateway.bksys.co.in (unknown [61.3.64.14]) by svr1.postgresql.org (Postfix) with ESMTP id 6F6ECD1B515 for ; Thu, 16 Oct 2003 10:08:35 -0300 (ADT) Received: from bksys.co.in (mail.bksys.co.in [192.168.1.1]) by Gateway.bksys.co.in (8.11.6/8.11.6) with ESMTP id h9GD8av21412; Thu, 16 Oct 2003 18:38:36 +0530 Received: from Bhuvan.bksys.co.in (Bhuvan.bksys.co.in [192.168.1.71]) by bksys.co.in (8.11.6/8.8.5) with ESMTP id h9GD8aO07922; Thu, 16 Oct 2003 18:38:36 +0530 Date: Thu, 16 Oct 2003 18:47:31 +0530 (IST) From: "A.Bhuvaneswaran" X-X-Sender: bhuvan@Bhuvan.bksys.co.in To: Ganesan Kanavathy Cc: "'Tom Lane'" , "'Rudi Starcevic'" , Subject: Re: pg_dump.. auto backup In-Reply-To: <000e01c3939b$22aad1e0$1300a8c0@headquarters.mq.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/175 X-Sequence-Number: 10736 > I don't really understand this. How to put password in ~/.pgpass. What > changes do I need to do on the script? How do I access to the password > to authenticate? Follow the below steps to automate your backup process. bash$ echo your_host:5432:your_user:your_db:your_pass > ~/.pgpass bash$ chmod 600 ~/.pgpass Now, run your script and it must have been automated. regards, bhuvaneswaran