dbTalk Databases Forums  

ERRORLEVEL values in batch files for reindexdb etc.

comp.databases.postgresql comp.databases.postgresql


Discuss ERRORLEVEL values in batch files for reindexdb etc. in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Justus Janssen
 
Posts: n/a

Default ERRORLEVEL values in batch files for reindexdb etc. - 08-10-2009 , 09:48 AM






Hi,

we've been using a batch file containing a call to reindexdb.exe ,
vacuumdb.exe and pg_dump.exe on a regular basis, and recently found that
sometimes one or more of these commands fail. To check that, I've added

IF %ERRORLEVEL%==0 GOTO (next step) ...
GOTO PGERROR

lines in the batch file, which seem to work perfectly for reindexdb.exe
and vacuumdb.exe . pg_dump however, does not set the ERRORLEVEL
variable. Is there a way to detect pg_dump has encountered a problem?
Right now, I'm testing by stopping the PostgreSQL service.

Also, is there a list of possible error values available for these commands?

Thanks,
Justus Janssen
Arpa, Veldhoven NL

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: ERRORLEVEL values in batch files for reindexdb etc. - 08-11-2009 , 02:15 AM






Justus Janssen wrote:
Quote:
we've been using a batch file containing a call to reindexdb.exe , vacuumdb.exe and pg_dump.exe on a regular basis, and recently
found that sometimes one or more of these commands fail. To check that, I've added

IF %ERRORLEVEL%==0 GOTO (next step) ...
GOTO PGERROR

lines in the batch file, which seem to work perfectly for reindexdb.exe and vacuumdb.exe . pg_dump however, does not set the
ERRORLEVEL variable. Is there a way to detect pg_dump has encountered a problem? Right now, I'm testing by stopping the PostgreSQL
service.

Also, is there a list of possible error values available for these commands?
Which version are you using?

I tried with an 8.2 Windows client installation, and ERRORLEVEL was set
appropriately.

For all tests I ran, the only error level returned was "1", no matter
if it was a connection problem or a problem with the database.

So your test as quoted above should work fine.

What do you get if you run:

pg_dump -h notexists nondatabase
echo %ERRORLEVEL%

in your MS-DOS box?

Yours,
Laurenz Albe

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.