Schedule task on boot once a week

Discuss RoboTask here
Post Reply
patrice38
Posts: 1
Joined: Mon Sep 17, 2007 1:25 am
Location: France

Schedule task on boot once a week

Post by patrice38 »

Hi,
I 'm looking for a way to schedule a task (delete files which cannot be deleted during a session) periodically (ie once a week) on reboot only.
I could use "Run when Robotask start"   OR use Scheduler Triggering Events ("once a week"), but don't know how to coodinate both so that task should not execute on each reboot, but only on the first reboot of a specific day in the week.
thanks for your help..
 
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Schedule task on boot once a week

Post by Oleg »

I think that you have to do so: you must launch task at start of RoboTask, but within task check the day of week (for example). Like this:

If {DayOfWeekNo} = 2 then
   ....
   Do something
   ...
end if

This task will do some operations only in monday

It's better if you will start RoboTask as NT service. It this case RoboTask can start you task before you log on.

To learn more about system variables open menu Options | Variables. Each system variable have a short description.
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Schedule task on boot once a week

Post by cagigas »

I am running a task on start, on tuesdays and thursdays, the way suggested in this thread. I use it to send an email.
But If I have to reboot my computer (i.e. installing a software, etc) the task runs again.

-How can I make the task run only once?

I have thought in global variables, like this (pseudocode):

if day = 3 or day = 5
......if sent = 0
...........send email
...........sent = 1
......endif
else
......sent = 0
endif

Sent is a Global Var. I have no previous experience with global vars.
Maybe I am complicating this too much. Is this a good solution? Is there a simpler, preferable way to accomplish this?
Many thanks :)
User avatar
robotask
Posts: 36
Joined: Thu May 02, 2013 11:19 am

Re: Schedule task on boot once a week

Post by robotask »

Write a log file and read that log file at system start.
If datediff from last run is less than 7 days, do not run task this time
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Schedule task on boot once a week

Post by cagigas »

Thank you!
Post Reply