0 votes

I have a scheduled task that needs to run every 2 hours, but it must not run outside of office hours. Is there any way to achieve this?

by (50 points)

1 Answer

0 votes
by (245k points)
selected by
Best answer

Hello,

Unfortunately, there is no possibility to configure the schedule of a task in such a way. Howevr, thank you for the suggestion, we forwarded It to the corresponding department for consideration.

As of now, you can achieve the desired using the below script in a condition of your task. The script returns true only if the current hour does not match any of those specified in the $excludeHours variable.

$excludeHours = @(3, 10, 15) # TODO: modify me

# Get current date
$currentDate = [System.DateTime]::UtcNow

foreach ($excludeHour in $excludeHours)
{
    if ($excludeHour -eq $currentDate.Hour)
    {
        $Context.ConditionIsMet = $False
        return
    }
}

$Context.ConditionIsMet = $True

Related questions

0 votes
1 answer

I would like to add "Configuration > Scheduled Tasks" to the Adaxes Web UI. I canĀ“t find an option to impelement this. Any hints?

asked Feb 9, 2021 by MatthiasP (40 points)
0 votes
1 answer

Is it possible to run a report to get users disabled in the last 24 hours?

asked Jun 10, 2020 by peggleg (110 points)
0 votes
1 answer

We're running version 3.9.15526.0 of Adaxes, and in the Web Interface when you try to edit the logon hours for the user, you can not select hours 9 and 10 individually. In ... top, and that does work. I confirmed that it doesn't work in either Chrome or IE.

asked Nov 28, 2018 by rurbaniak (1.4k points)
0 votes
1 answer

Hi, Is there a way to store information throughout the running of a custom command? For instance, when creating a user, we use a custom command to move the user ... the entire process with the information, rather than 5 or 6 generated throughout the process.

asked Dec 16, 2022 by gareth.aylward (180 points)
0 votes
1 answer

Is the further clarification on how to join the Adaxes service to the configuration set during a multi-sever upgrade

asked Nov 16, 2022 by itsupport (20 points)
3,008 questions
2,726 answers
7,021 comments
216,387 users