Dear Friends,
In Agent Property, there is no way i can set up an agent to run automatically each 2 day. Is it any posible way to manipulate this. As far as i know, the listed schedule were like this:
-
More Than Once A Day
-
Daily
-
Weekly
-
Monthly
-
Never
TIA,
Joseph
Subject: Run Scheduled Agent each 2 day
Schedule the agent “Daily”.In the agent code, check the current date against the agents “LastRun” property to decide the execution.
i.e.
If currentdate - 1 day = agent.LastRun then
don’t proceed
else
proceed
Ashish
Subject: RE: Run Scheduled Agent each 2 day
If you put this code in the agent, won’t the agent run every day and only get as far as checking to see if it ran yesterday (it did) and then never execute the rest of your code since the agent ran yesterday but only got as far as the check to see if it ran yesterday?
Subject: RE: Run Scheduled Agent each 2 day
Oops!Thanks John for pointing that out.
Joseph, the logic i posted will fail since the agent would run everyday and hence the LastRun property would always fetch the previous date.
You could maintain the last run date in a profile document and check against that.
Sorry for the inconvience,
Ashish
Subject: RE: Run Scheduled Agent each 2 day
You could run it every odd/even weekday without the use of a profile document. Doing it this way would result in two consecutive runs for odd days (Saturday = day 7 and Sunday = day 1) or a two day delay when using even days though so that may not work.
dgg
If Weekday(Today) Mod 2 > 0 Then
Print "This is an odd weekday - don't run the agent!"
'exit sub, etc
Else
Print "This is an even weekday - run the agent!"
'continue with execution
End If
Subject: Thank you Ashish for the help