Re: No password supplied error when running a batch script as a programmed task

From: Frank Pinto <frank(dot)joseph(dot)pinto(at)gmail(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: PGSQL-Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: No password supplied error when running a batch script as a programmed task
Date: 2016-02-29 19:52:14
Message-ID: CAATpuJoOJTZvr_OPQP9QQrP5Tb_Jo7G51HHJ6V6mBWY1nUF8DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I haven't used PostgreSQL in Windows but I know in Unix based systems the
pgpass file is located in your home folder. Where is it on Windows? If its
in your user account's folder then try checking to see what user the Task
Scheduler's tasks run as, it could be looking for a global pgpass file that
doesn't exist.

Frank

On Mon, Feb 29, 2016 at 12:45 PM, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
wrote:

> I wonder if this question belongs here. Please let me know in order to
> look for another place to ask.
>
> I have PostgreSQL installed on Windows Server 2008 R2 and wrote a batch
> script to get a backup of a database. Such a script must run automatically
> so I created a task in the Task Scheduler which runs under the
> Administrator account. This task fails running the batch script and
> provides the following message:
>
> fe_sendauth: no password supplied
>
> However, if I run the script directly double clicking of it, the batch
> executes successfully. The pgpass.conf file is also correct, otherwise, the
> batch script would not run manually.
>
> I will very much appreciate your feedback.
>
> The batch has the following instructions:
>
> echo off
> d:
> cd "D:\Program Files (x86)\PostgreSQL\9.3\bin"
>
> SET mes=%date:~3,2%
> SET dia=%date:~0,2%
> SET anio=%date:~6,4%
>
> IF %TIME:~0,2% LSS 10 (SET hra=0%TIME:~1,1%) ELSE (SET hra=%TIME:~0,2%)
> IF %TIME:~3,2% LSS 10 (SET min=0%TIME:~4,1%) ELSE (SET min=%TIME:~3,2%)
>
> echo on
> time /t
> rem echo off
> pg_dump -E win1252 -f
> d:/respaldos/edocuments/edoc_%anio%%mes%%dia%_%hra%%min%.backup -F p -n
> edocuments -h localhost -U postgres -w edocuments
> pg_dump -E win1252 -f
> z:/respaldos/edocumentsdb/edoc_%anio%%mes%%dia%_%hra%%min%.backup -F p -n
> edocuments -h localhost -U postgres -w edocuments
> echo on
> time /t
> rem echo off
> pause
>
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tobias Florek 2016-03-01 11:04:27 WHERE clause not used when index is used
Previous Message JORGE MALDONADO 2016-02-29 18:45:38 No password supplied error when running a batch script as a programmed task