Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread JOB runs repeatedly
Tue, Jul 30 2013 8:42 AMPermanent Link

Adam Brett

Orixa Systems

I have a JOB scheduled to run once per hour.

Usually it does this & works well.

Sometimes it seems to run at least once per minute (perhaps more than this, I can't tell).

Can anyone tell me the circumstances under which a JOB will re-run repeatedly?

I am guessing that it might occur if there was an exception during execution, or perhaps if a connection was lost to a remote computer during the execution of the JOB or something similar.
Tue, Jul 30 2013 2:01 PMPermanent Link

Uli Becker

Adam,

I had the same problem: you are right, the job is not executed
successfully. That's why it's repeated every minute.

You can check the server logs using EDBManager or query the logevents
table to see what's wrong.

select * from configuration.logEvents

In addition you can execute the job as a script and see what's going on.

Regards Uli
Wed, Jul 31 2013 7:19 AMPermanent Link

Adam Brett

Orixa Systems

Thanks Uli,

It would be really useful to disable this behaviour, I guess it is possible to do this using some complicated script which tested the contents of the Log, but I wonder whether there is an easy way to stop a JOB from running if it fails a number of times?
Wed, Jul 31 2013 8:59 AMPermanent Link

Uli Becker

Adam,

> It would be really useful to disable this behaviour, I guess it is possible to do this using some complicated script which tested the contents of the Log, but I wonder whether there is an easy way to stop a JOB from running if it fails a number of times?

I use this to supervise my jobs:

1. Create a table which contains the jobs you want to control.
2. Create a column "JobEnabled" in this table
3. Run the job with a condition "JobEnabled"
4. Use an exception block and disable the job when the job fails.

In addition you can use a dll to send an email e.g. when that happens. Smile

Regards Uli
Wed, Jul 31 2013 6:45 PMPermanent Link

Adam Brett

Orixa Systems

Thanks Uli,

I just wrote a DLL to send email so that will be useful!

The main reason why Jobs were failing was because part of the Job included a statement to copy a file to a remote store. If the remote store connection failed, I got the exception.

I have created a Function to test for the connection as a first step in the Job. If this Function fails, then I don't run the rest of the Job.

I include the code for the Function here for others. Note it depends on the existence of a particular remote store, so other users would have to re-write it!

I think your idea of a Job-monitoring-table is a good one ... I will have to add it to my users' systems, when I find the time Frown...

--

EXECUTE IMMEDIATE
' CREATE FUNCTION "RemoteStoreIsAvailable" ()
RETURNS BOOLEAN
BEGIN                              

 -- simple function to test that the remote store
 -- is available, by simply trying to open 1 known
 -- store.
 -- NOTE: that this function only works if we are
 -- sure that the named store will always exist and
 -- always contain at least 1 file

 DECLARE RESULT BOOLEAN DEFAULT false;
 DECLARE StoreName VARCHAR(100);
 DECLARE Crsr CURSOR FOR Stmt;

EXECUTE IMMEDIATE
'' SET FILES STORE TO CloudReports'';

PREPARE Stmt FROM
'' SELECT Name FROM Information.Files '';
OPEN Crsr;                  

SET RESULT = (ROWCOUNT(Crsr) > 0);
 RETURN RESULT;
 EXCEPTION
 -- do nothing we don''t want the function to
 -- generate an error which might stop the
END

VERSION 1.00';
Image