Replies: 1 comment
-
Hello,
Thanks for your interest in AutoShutdownSchedule.
I understand you thought behind more flexible ways to enter days and times. However, it will be a bit complex both to code and also to use. Of course it is possible but I have not had the need myself and no one else has asked for it either.
About running over several subscriptions, that also is possible but I have opted not to do that. The reason is that it will take a while to iterate through subscriptions, I believe it is better to have one automation account and runbook in each subscription.
Tag values would be a bit specific, another user might very well have need for other tags. Just skip the tag for machines that should always run.
It is a balance in having the script flexible but not too complex.
Thanks again!
Regards,
Tomas
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I was just starting to write something like this as most of the solutions I saw didn't have enough power/flexibility, specifically coding schedule tokens into a single tag to allow flexible shutdown/startup times that vary by resource.
My requirements are to allow weekday schedules and weekend schedules, and allow an override for a specific day (e.g. for a change implementation/test run after hours). So, I wanted something that could do:
6pm -> 6am, Thursday 10pm -> 6am, Saturday 12:00 -> 16:00, Sunday
Looks like the code has an error - it doesn't pick up most specific to least specific, it takes whichever value works first. So, with 6pm->6am specified first in my example, it will never check the Sunday all day off. But if you modify this to put the 6pm->6am at the end, it still has an issue where Saturday the VM will turn on at midnight and stay on until noon, then turn off at 4pm. If we could put in multiple Saturday schedules we could turn off Saturday at midnight, stay off until 6am, then wakeup until noon. This is documented as being possible (multiple windows where a machine will turn off), but again, as soon as a match is found there is a BREAK taking it out of the loop, ANY range first, then a specific time to turn off, then a matching day of the week, then a matching date.
It might be better to change this to a coded system like A1806 (all days of week, turn off at 6pm, turn on at 6am), or B1806C0000 (weekdays off at 6pm, on at 6am, weekends off all day), or B1806C0000M2424F2424 (weekdays 6pm-6am, weekends off, Monday on all day, Friday on all day). This allows for order of specificity checking (specific day first, then weekend/weekday check, then the all days check).
I also need multiple subscriptions, was hoping to pass a list of subscriptions and just do a foreach loop through that list in your main code right where we see the "Retrieve subscription name from variable asset if not specified" comment. Thoughts?
Finally, I'd love to also check for environment tag values, such as if a machine isn't marked as Dev/Test/QA/Staging, we don't turn them off (or just check for a Prod tag). Thoughts?
I'll fork off of your code and let you review my branch when you get a chance, maybe incorporate some of these ideas.
Thanks!
Mark
Beta Was this translation helpful? Give feedback.
All reactions