[GH-ISSUE #1105] Reestablish tasks running at first opportunity if missed because it's in the past or was offline at the time of task #2623

Closed
opened 2026-03-14 04:51:39 +03:00 by kerem · 7 comments
Owner

Originally created by @silversword411 on GitHub (Apr 28, 2022).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1105

Originally assigned to: @silversword411 on GitHub.

Re-establishing this feature:
https://github.com/amidaware/tacticalrmm/issues/247

Will fix 2 cases:

  1. Have an onboarding policy that will run once. Set a task in the far past that applies via automation, and it'll run once for new machines.
  2. If agents are offline at their scheduled task time, they'll run at their first opportunity when they come back online.
Originally created by @silversword411 on GitHub (Apr 28, 2022). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1105 Originally assigned to: @silversword411 on GitHub. Re-establishing this feature: https://github.com/amidaware/tacticalrmm/issues/247 Will fix 2 cases: 1. Have an onboarding policy that will run once. Set a task in the far past that applies via automation, and it'll run once for new machines. 2. If agents are offline at their scheduled task time, they'll run at their first opportunity when they come back online.
kerem 2026-03-14 04:51:39 +03:00
  • closed this issue
  • added the
    fixed
    label
Author
Owner

@sadnub commented on GitHub (Apr 29, 2022):

I believe this is already implemented. Run once tasks will created in the future on agents if the time is in the past. There is also a Run ASAP after missed check box that you can use for tasks to run if missed

<!-- gh-comment-id:1113407647 --> @sadnub commented on GitHub (Apr 29, 2022): I believe this is already implemented. Run once tasks will created in the future on agents if the time is in the past. There is also a Run ASAP after missed check box that you can use for tasks to run if missed
Author
Owner

@silversword411 commented on GitHub (Apr 29, 2022):

When do they get calculated and run properly? This is just one example of...lots. These automations have been around for a while, do I need to delete/recreate them maybe?

2022-04-29_132144 - missed alerts

2022-04-29_132416 - automation task

<!-- gh-comment-id:1113552021 --> @silversword411 commented on GitHub (Apr 29, 2022): When do they get calculated and run properly? This is just one example of...lots. These automations have been around for a while, do I need to delete/recreate them maybe? ![2022-04-29_132144 - missed alerts](https://user-images.githubusercontent.com/13395348/165993086-5b98489c-3215-4221-abd1-e330125a82a5.png) ![2022-04-29_132416 - automation task](https://user-images.githubusercontent.com/13395348/165993468-da9e3a44-c7ba-4ba7-afb4-de375d2e9e6c.png)
Author
Owner

@wh1te909 commented on GitHub (May 10, 2022):

just tested and working for me, please watch the attached GIF and at the end you'll see the task gets set to run at 5 minutes past the current time. might need to recreate from scratch

chrome_mvz0g4yAK0

<!-- gh-comment-id:1123000749 --> @wh1te909 commented on GitHub (May 10, 2022): just tested and working for me, please watch the attached GIF and at the end you'll see the task gets set to run at 5 minutes past the current time. might need to recreate from scratch ![chrome_mvz0g4yAK0](https://user-images.githubusercontent.com/7434746/167739485-dad6c8f2-5c86-48df-9f0a-3fd627e22099.gif)
Author
Owner

@silversword411 commented on GitHub (May 11, 2022):

Can't scrub and re-watch specific portions of animated .gifs, so hard to catch details at a specific portion...but I don't think the problem is TRMM creating the event. It's doing everything that it's been told to do.

I think the fundamental problem is that windows isn't/doesn't respect the "run if missed" flag if the event is created with a time in the past (via api?) and the computer pass over that time at least once to put it into it's task queue.

This picture is of the 2021 event that was created 4/29/2022. Why hasn't it run yet? It's in the past, it's got the "Run task as soon as possible after the scheduled start is missed".

Still hasn't run though.

2022-05-11_082209 - mmc_Computer_Management

I wonder if we can find out why these events aren't run in windows....or maybe there should just be an official "onboarding" process if we can't get it running reliably?

<!-- gh-comment-id:1123758678 --> @silversword411 commented on GitHub (May 11, 2022): Can't scrub and re-watch specific portions of animated .gifs, so hard to catch details at a specific portion...but I don't think the problem is TRMM creating the event. It's doing everything that it's been told to do. I think the fundamental problem is that windows isn't/doesn't respect the "run if missed" flag if the event is created with a time in the past (via api?) and the computer pass over that time at least once to put it into it's task queue. This picture is of the 2021 event that was created 4/29/2022. Why hasn't it run yet? It's in the past, it's got the "Run task as soon as possible after the scheduled start is missed". Still hasn't run though. ![2022-05-11_082209 - mmc_Computer_Management](https://user-images.githubusercontent.com/13395348/167859968-c13b25c1-1466-4f06-a36f-e9cdcab2f239.png) I wonder if we can find out why these events aren't run in windows....or maybe there should just be an official "onboarding" process if we can't get it running reliably?
Author
Owner

@wh1te909 commented on GitHub (May 11, 2022):

I have attached a video now. Yes windows will not run if missed unless the time has already passed, so to get around that, when you create the task using trmm and set the date in the past, trmm will notice that the date is in the past, and change it to the current time + 5 minutes, before sending it to the agent. So it will be created with a date in the future, not past (in trmm web UI it will show the past time, we need to fix that, but if you look in task scheduler the time will be in the future, as shown in the video).

https://user-images.githubusercontent.com/7434746/167910768-f7bccce3-6b4b-4fca-83ef-055c0cc59a5f.mp4

<!-- gh-comment-id:1124056714 --> @wh1te909 commented on GitHub (May 11, 2022): I have attached a video now. Yes windows will not run if missed unless the time has already passed, so to get around that, when you create the task using trmm and set the date in the past, trmm will notice that the date is in the past, and change it to the current time + 5 minutes, before sending it to the agent. So it will be created with a date in the future, not past (in trmm web UI it will show the past time, we need to fix that, but if you look in task scheduler the time will be in the future, as shown in the video). https://user-images.githubusercontent.com/7434746/167910768-f7bccce3-6b4b-4fca-83ef-055c0cc59a5f.mp4
Author
Owner

@silversword411 commented on GitHub (May 11, 2022):

Yeah....so it's the time of windows task creation that does the 5min workaround dance...and these aren't working because they're 4/25 created tasks (which might be <v0.13.3 tasks).

Now I know the 5min thing, Let me see if I can get it working without completely rebuilding all the automation ;)

<!-- gh-comment-id:1124121603 --> @silversword411 commented on GitHub (May 11, 2022): Yeah....so it's the time of windows task creation that does the 5min workaround dance...and these aren't working because they're 4/25 created tasks (which might be <v0.13.3 tasks). Now I know the 5min thing, Let me see if I can get it working without completely rebuilding all the automation ;)
Author
Owner

@silversword411 commented on GitHub (May 17, 2022):

Confirmed working with newly created tasks

<!-- gh-comment-id:1128297294 --> @silversword411 commented on GitHub (May 17, 2022): Confirmed working with newly created tasks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#2623
No description provided.