Domino Code Fragment
Code Name* IsOverwriteFile property | Date* 04/28/2024 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:.52.15.63.145 | |
Description* 2. This agent script sets the IsOverwriteFile property to true if the agent last ran over seven days ago. If the agent last ran within the last seven days, it sets the IsOverwriteFile property to false. | Type* Java | Categories* (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: |
public class overwritefile2agent extends AgentBase
{
public void NotesMain()
{
try
{
Session s = getSession();
AgentContext ac = s.getAgentContext();
Log log = s.createLog("Overwrite file");
DateTime lastRun = ac.getLastRun();
DateTime nowDateTime = s.createDateTime("");
nowDateTime.setNow();
int daysSinceRun =
nowDateTime.timeDifference(lastRun) / 86400;
if (daysSinceRun > 7)
log.setOverwriteFile(true);
else
log.setOverwriteFile(false);
log.openFileLog("over.log");
log.logAction("Logged an action");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}