Change "scheduled agent" with script and prevent it from running immediatly?

Hi,

I need to change some properties on scheduled agents (server to run on, …) with script (!! not manually). If I do this the agent usually starts running immediatly. (This is the normal and correct behavior)

If I would do this changes manually then I could set the property “Start running agent on this date” and set it to tomorrow. But with script this property is not accessible :-((

Does anybody have an idea how to change an scheduled agent and prevent it to run ?

Does anybody know how to set the

“Start running agent on this date” property via script or API ?

Any other ideas ?

TIA

Lars

Subject: Change “scheduled agent” with script and prevent it from running immediatly ?

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/172cb77580acc5c880256b44005bd0a3?OpenDocument

Subject: Thats exactly it. Sorry i did not find it but i searched. THANKS.

Subject: RE: Change “scheduled agent” with script and prevent it from running immediatly ?

Lars -

A simple way of preventing a scheduled agent from running outside of its normal schedule is to do a time comparison before the “real” code actually begins.

So, for instance, if you want it to always run before 6am . . .

'// Enforce a general schedule to prevent a design refresh/save from triggering the agent.

If nsess.IsOnServer Then '// only check if agent is running on the server

If Hour(Now) > 5 Then

Print nsess.CurrentAgent.Name & " must run before 6:00 AM . . ."

Goto subExit

End If

End If

In the above example, the process is just directed to the exit label of the current subroutine. You could also just raise an error.

If you really want to be thorough, you could have the agent check its schedule by way of:

(1) DXL export of a NotesNoteCollection, or

(2) C API calls from within your LS code.

Having written this database for viewing agent information, I would suggest using the DXL method vs. using the C API. It’s more portable and probably a bit more intuitive. The information is contained in the “trigger” tag (see below). If the trigger type is “scheduled”, you would examine the value of the “starttime” tag which, for the snippet below, is 5:30am. Then your code would need decide whether or not it should run based on the current time.

T053000,00

Keep in mind that processing the XML will impact the time required for the agent to complete.

hth,

dgg

Subject: Works great. Thanks as well.