[re-adding the list]
On Wed, Feb 6, 2013 at 10:41 PM, Bastiaan Olij <bastiaan@basenlily.me> wrote:
> Hey Dave,
>
> As you've read from David's reply the job's status now comes back as
> successful which solves our immediate issue. I did a little more testing
> to see if I could get it to react to different exit codes and that seems
> to still be ignored so the GetExitCodeProcess command doesn't seem to do
> it's thing (or I'm doing something wrong).
It worked for me :-)
> I simply added an EXIT /B 2 at the end of the script to see if it would
> pick up the error code 2 but the error code returned remained 0.
Remove the /B and it should work. GetExitCodeProcess is returning the
cmd.exe return value, not the scripts ERRORLEVEL.
> Mind you, reading the documentation on GetExitCodeProcess it doesn't
> return an error code if the process hasn't finished running yet and it
> also mentions it's only supported on desktop applications and may thus
> not be available to a service.
I just tested it as a service and it worked fine :-). Proof attached!
(ids 32 and above are run as a service, with pgAgent running under the
LocalSystem account). Ignore some of the earlier ones - they were me
debugging.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company