-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging Timers and Schedules #647
Comments
There is actually a slight difference between the two:
Schedules could have an interval of 1sec, but they would start getting messy/laggy very quickly - so normally 1min is preferred. I do agree that Cron Expressions on Wndows is a weird thing not many people would be familiar with. We could maybe introduce a Such as every 10mins, but only on a Tuesday would be: $cron = New-PodeScheduleCron -Minute 0, 10, 20, 30, 40, 50 -Day Tuesday
Add-PodeSchedule -Cron $cron -Etc 🤔 |
I've added a new helper function, The main way to use # Everyday, at 00:00
New-PodeCron -Every Day
# Every Tuesday and Friday, at 01:00
New-PodeCron -Every Day -Day Tuesday, Friday -Hour 1
# Every 15th of the month at 00:00
New-PodeCron -Every Month -Date 15
# Every other day, starting from the 2nd of each month, at 00:00
New-PodeCron -Every Date -Interval 2 -Date 2
# Every 1st June, at 00:00
New-PodeCron -Every Year -Month June
# Every hour, starting at 01:00
New-PodeCron -Every Hour -Hour 1 -Interval 1
# Every 15 minutes, between 01:00 and 05:00
New-PodeCron -Every Minute -Hour 1, 2, 3, 4, 5 -Interval 15
# Every hour of every Monday (ie: 00:00, 01:00, 02:00, etc.)
New-PodeCron -Every Hour -Day Monday
# Every 1st January, April, July, and October, at 00:00
New-PodeCron -Every Quarter
# Everyday at 05:15
New-PodeCron -Every Day -Hour 5 -Minute 15 You can also use # Every 10 minutes on Tuesdays
New-PodeCron -Day Tuesday -Minute 0, 10, 20, 30, 40, 50
# Every minute on Tuesdays
New-PodeCron -Day Tuesday The value returned by # Every Tuesday, at 00:05
$cron = New-PodeCron -Day Tuesday -Hour 0 -Minute 5
Add-PodeSchedule -Name 'date' -Cron $cron -ScriptBlock {
Write-Host "$([DateTime]::Now)"
} |
Should Timers and Schedules be refactored and merged into one function.
Possible adding a flag -schedule to make it in a schedule?
I understand cron has a well known timing schedule but still not as common to those coming from windows world.
And as a long time PowerShell user, having the Timers syntax is a bit more nicer to look :
-Start
-End
-Count
and similar
Are schedules suppose to persist after a server a restart, while timers would not ?
The text was updated successfully, but these errors were encountered: