SecondSonConsulting / Renew

A macOS script to encourage users to restart their workstations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change DeferralDuration increment to Minutes instead of Hours

fogdogit-paul-s opened this issue · comments

Suggestion - to change increments for the DeferralDuration key to miuntes instead of hours. this would allow for more granular control!

good suggestion. I can see this being really useful during testing.

I understand why you may want to use this in testing, but changing the math/value from hours to minutes in the configuration file would break the current setup for anyone using it and I don't feel like this need is worth a configuration breaking change at this time (even though its still technically beta)

What if I add a testing flag that applies a 5 or 10 minute deferral instead of the value configured in the profile.

--forceDeferral5 and --forceDeferral10 This would run Renew, but ONLY process a deferral setting the value to 5 or 10 minutes in the future. You could then call Renew and it would exit quietly as though a deferral were in place.

Would this provide what you need?

I'm happy to add this for future use if you think this is useful, but for your immediate needs I have this suggestion.

Option 1: Set the DeferralDuration value to 0 in the configuration file, which will cause Renew to process a deferral and update the user deferral plist file, however the next time you call Renew the deferral will have already passed. This is what I do for testing.

Option 2: You can manually change the <key>ActiveDeferral</key> integer found in ~/Library/Preferences/com.secondsonconsulting.renew.user.plist and Renew will act as though a deferral is active.

The value in that key is set by the following logic "Get the epoch date in seconds right now, and then add time to it based on the deferral duration in the configuration file". Then when Renew runs, it checks the current epoch time to determine whether it's past the ActiveDeferral key.

You can populate that field manually for now, use date '+%s' to get the current epoch time and then add X seconds to that number for how long you want an active deferral.

The <key>HumanReadableDeferDate</key> in the preference plist is not used for any actual functionality, and only used for a tech to understand when the next deferral runs out.

I'm not sure how github works with notifying you to replies on your issues, so i'll tag you here to make sure you see my previous response @fogdogit-paul-s @techtherapy

thanks @BigMacAdmin - a deferral flag would be excellent. would the time increment be variable? If not I would (personally) prefer to see a shorter time interval (1 or 2 min) as well as perhaps a 5/10 min one.

Thanks for the testing suggestions. I will, in the interim do just that.

I'm not sure how github works with notifying you to replies on your issues, so i'll tag you here to make sure you see my previous response @fogdogit-paul-s @techtherapy

I am following this thread - so get lots of nice emails whenver a message is posted, whether you "@" me or now :)

v0.1.10 added the --defer n key which works similar to --reset but instead of resetting deferrals, it processes a deferral for n minutes in the future.

Since minute long deferrals don't really make sense in production, I'll consider this request completed.