Thread: pgAdmin not starting my job

pgAdmin not starting my job

From
Rainer Bauer
Date:
Hello,

I'm running PostgreSQL 8.3.7 with pdAdmin 1.8.4 on WinXPSP3.

I installed pgAdmin following the instructions here
<http://www.pgadmin.org/docs/1.8/pgagent.html> and here
<http://www.postgresonline.com/journal/index.php?/archives/19-Setting-up-PgAgent-and-Doing-Scheduled-Backups.html>.

I created a batch file to do the backup. When logged in as Administrator
and running the batch file it works. When opening a command prompt as
user postgres [runas /user:postgres cmd.exe] and executing the batch
file it works, too.

For both users the password is set in
C:\Documents and Settings\<UserName>\Application Data\postgresql\pgpass.conf

When registering the pgAgent service I use the postgres user account
that was created during the PostgreSQL installation process. The root
user for the database is also called postres.
pgAgent.exe INSTALL pgAgent -u postgres -p XXXXXX hostaddr=127.0.0.1 dbname=postgres user=postgres

The service is then manually started in the computer management
console. Successfully.

After setting up the job in pgAdminIII, I try to run it (via the
context menu) but nothing happens. "Nothing" means the backup is not
created, but the job status in pgAdmin is altered: "Last result" says
"Successful" and the "Last Run" time is updated.

The job was created as "Batch" kind and the batch script specified in
the job definition:
F:\Daten\Munnin\PostgreSQL\pgagent\backup.bat

So the question is: what am I doing wrong?

The PostgreSQL log file does not give any hints, even with
log_min_messages=debug5

Rainer



Re: pgAdmin not starting my job

From
Dave Page
Date:
On Fri, Apr 24, 2009 at 8:48 PM, Rainer Bauer <usenet@munnin.com> wrote:
> Hello,
>
> I'm running PostgreSQL 8.3.7 with pdAdmin 1.8.4 on WinXPSP3.
>
> I installed pgAdmin following the instructions here
> <http://www.pgadmin.org/docs/1.8/pgagent.html> and here
> <http://www.postgresonline.com/journal/index.php?/archives/19-Setting-up-PgAgent-and-Doing-Scheduled-Backups.html>.
>
> I created a batch file to do the backup. When logged in as Administrator
> and running the batch file it works. When opening a command prompt as
> user postgres [runas /user:postgres cmd.exe] and executing the batch
> file it works, too.
>
> For both users the password is set in
> C:\Documents and Settings\<UserName>\Application Data\postgresql\pgpass.conf
>
> When registering the pgAgent service I use the postgres user account
> that was created during the PostgreSQL installation process. The root
> user for the database is also called postres.
> pgAgent.exe INSTALL pgAgent -u postgres -p XXXXXX hostaddr=127.0.0.1 dbname=postgres user=postgres
>
> The service is then manually started in the computer management
> console. Successfully.
>
> After setting up the job in pgAdminIII, I try to run it (via the
> context menu) but nothing happens. "Nothing" means the backup is not
> created, but the job status in pgAdmin is altered: "Last result" says
> "Successful" and the "Last Run" time is updated.
>
> The job was created as "Batch" kind and the batch script specified in
> the job definition:
> F:\Daten\Munnin\PostgreSQL\pgagent\backup.bat
>
> So the question is: what am I doing wrong?

Anything in the event log? Try putting an echo statement in the
definition to output something - it should show up in the job step
output.


-- 
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com


Re: pgAdmin not starting my job

From
Rainer Bauer
Date:
Hello Dave,

Sunday, April 26, 2009, 8:02:22 PM, you wrote:

DP> On Fri, Apr 24, 2009 at 8:48 PM, Rainer Bauer <usenet@munnin.com> wrote:
>> After setting up the job in pgAdminIII, I try to run it (via the
>> context menu) but nothing happens. "Nothing" means the backup is not
>> created, but the job status in pgAdmin is altered: "Last result" says
>> "Successful" and the "Last Run" time is updated.
>>
>> The job was created as "Batch" kind and the batch script specified in
>> the job definition:
>> F:\Daten\Munnin\PostgreSQL\pgagent\backup.bat
>>
>> So the question is: what am I doing wrong?

DP> Anything in the event log? Try putting an echo statement in the
DP> definition to output something - it should show up in the job step
DP> output.

The event log does not contain any entries.

No matter what I put into the batch file, the only thing that is shown
in Column "Output" is the text: C:\WINDOWS\System32>F:\Daten\Munnin\PostgreSQL\pgagent
"There" refers to selecting pgAdminIII>myDatabase>Jobs>myJob>Steps(1)>MyStep
and then activating the Statistics tab.
Not sure if that is what you meant by "job step output".

But while doing some further tests, I found the mistake I made. I have
splitted the backup batch file into several batch files. And when I
tested it in the console the CWD was correct. However, when the main
batch file is called from pgAgent the CWD is different and the batch
files called from the main one are not found.

Maybe adding a hint in the documentation will help others users in the
future not to fall into this pitfall.

Anyway, thanks for the response.

Rainer



Re: pgAdmin not starting my job

From
Rainer Bauer
Date:
Hello Dave,

Sunday, April 26, 2009, 11:14:53 PM, I wrote:

RB> But while doing some further tests, I found the mistake I made. I have
RB> splitted the backup batch file into several batch files. And when I
RB> tested it in the console the CWD was correct. However, when the main
RB> batch file is called from pgAgent the CWD is different and the batch
RB> files called from the main one are not found.

Now it gets really weird: It run only once (although it is scheduled
daily)

I cannot even run it manually. If I try to, the "Last run" field does
not get updated, but the "Next run" field is updated with the current
time. However it is never executed, i.e. the "Statistics" tab always
shows the last entry is from 4/26/2009.

The service is running (I have even restarted it), but nothing is
logged in the PostgreSQL log file or the system event log.

So back to the basic question: how can I find out what is going wrong?

Rainer

PS: Is there any way to see the complete text of the "Output" column
in the steps "Statistics" tab? Since the column is at the rightmost
side of the window, the tooltip window appearing does not show much
information. I have to restore the pgAdminIII window and move it to
the left side of the screen to see at leasy the first line of the log
file.
I know I can view the log in pga_jobsteplog table, but it would be
helpful if the jsloutput content could be displayed in an editor.



Re: pgAdmin not starting my job

From
Dave Page
Date:
On Tue, Apr 28, 2009 at 11:22 AM, Rainer Bauer <usenet@munnin.com> wrote:
> Hello Dave,
>
> Sunday, April 26, 2009, 11:14:53 PM, I wrote:
>
> RB> But while doing some further tests, I found the mistake I made. I have
> RB> splitted the backup batch file into several batch files. And when I
> RB> tested it in the console the CWD was correct. However, when the main
> RB> batch file is called from pgAgent the CWD is different and the batch
> RB> files called from the main one are not found.
>
> Now it gets really weird: It run only once (although it is scheduled
> daily)
>
> I cannot even run it manually. If I try to, the "Last run" field does
> not get updated, but the "Next run" field is updated with the current
> time. However it is never executed, i.e. the "Statistics" tab always
> shows the last entry is from 4/26/2009.

What database is the pgagent schema in, what database is set as the
maintenance database for the server in pgAdmin, and what database is
specified in the pgAgent connection string?

> The service is running (I have even restarted it), but nothing is
> logged in the PostgreSQL log file or the system event log.
>
> So back to the basic question: how can I find out what is going wrong?

Uninstall and reinstall the service with -l2 added to the command line
(before the connection string).

> Rainer
>
> PS: Is there any way to see the complete text of the "Output" column
> in the steps "Statistics" tab? Since the column is at the rightmost
> side of the window, the tooltip window appearing does not show much
> information. I have to restore the pgAdminIII window and move it to
> the left side of the screen to see at leasy the first line of the log
> file.
> I know I can view the log in pga_jobsteplog table, but it would be
> helpful if the jsloutput content could be displayed in an editor.

Unfortunately there's no way to resize that control at present -
you'll need to query the table manually.


-- 
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com


Re: pgAdmin not starting my job

From
Rainer Bauer
Date:
Hello Dave,

Wednesday, April 29, 2009, 9:32:20 AM, you wrote:

>> I think it would be helpful if the -l2 option was documented in the
>> "Service installation on Windows" section
>> <http://www.pgadmin.org/docs/1.8/pgagent-install.html>

DP> Err, it is.

Shame on me.

Thanks for the support. Everything works like a charm now.

Rainer



Re: pgAdmin not starting my job

From
Dave Page
Date:
On Thu, Apr 30, 2009 at 2:53 PM, Rainer Bauer <usenet@munnin.com> wrote:
> Hello Dave,
>
> Wednesday, April 29, 2009, 9:32:20 AM, you wrote:
>
>>> I think it would be helpful if the -l2 option was documented in the
>>> "Service installation on Windows" section
>>> <http://www.pgadmin.org/docs/1.8/pgagent-install.html>
>
> DP> Err, it is.
>
> Shame on me.
>
> Thanks for the support. Everything works like a charm now.

:-)



-- 
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com


Re: pgAdmin not starting my job

From
Dave Page
Date:
On Tue, Apr 28, 2009 at 11:58 PM, Rainer Bauer <usenet@munnin.com> wrote:
> Hello Dave,
>
>>> So back to the basic question: how can I find out what is going wrong?
>
> DP> Uninstall and reinstall the service with -l2 added to the command line
> DP> (before the connection string).
>
> That did the trick. I had renamed the pgpass.conf file of the postgres
> account. The strange thing is that it worked after the rename, but not
> after the reboot.

I guess libpq cached it, or kept it open.

> I think it would be helpful if the -l2 option was documented in the
> "Service installation on Windows" section
> <http://www.pgadmin.org/docs/1.8/pgagent-install.html>

Err, it is.

-- 
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com