GithubHelp home page GithubHelp logo

Comments (19)

gkluoe avatar gkluoe commented on August 22, 2024

Hi! We have it set to run once per day on recurring checkin (which in practice seems to mean it runs pretty soon after people first wake up the machine for the day) but we also have another set of triggers which attempt to wake the machine wake up at night and call the policy again - in the hope that most updates will occur overnight without needing to bother the user.

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

/var/db/UoESoftwareUpdateDeferral just contains a date, and users are allowed to defer restarting if the date in the file is less than DEFER_LIMIT days ago. Happy to help get this working for you if you're interested.

from jss.

scottlep avatar scottlep commented on August 22, 2024

Great. Thanks for the quick response!!! Is the daily check-in trigger what will also run the deferral prompt again each day until the deadline has been reached? Also, if running daily I assume that if there no pending updates then noting will happen as far as notifying the user?

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

Yes, exactly. If there are no pending updates, or even if updates are installed that don't require a restart, the user doesn't see anything.

from jss.

scottlep avatar scottlep commented on August 22, 2024

Awesome! This is exactly what I have been looking for.

I am fairly new to Jamf, about 6 months. Came from 7+ years in a Munki environment where this could be done without the custom scripting. I appreciate you sharing the script and your help with my questions.

Thanks!!
Scott

from jss.

scottlep avatar scottlep commented on August 22, 2024

One more question. Have you tested any way to allow users to be prompted to save any open files if they choose to click the restart now option? Similar to how users would be asked to save open files if they restart or log-out from the Apple menu?

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

In fact that's exactly what it's supposed to do:

def friendly_logout():
    user = console_user()
    subprocess.call([ 'sudo', '-u', user, 'osascript', '-e', u'tell application "loginwindow" to  «event aevtrlgo»' ])

The 'aevtrlgo' event should initiate a logout without asking for confirmation of the logout, but should still allow the user to save any unsaved work. If we wanted to be really evil we could kill the loginwindow process, but I've never been a fan of that.

from jss.

scottlep avatar scottlep commented on August 22, 2024

Hmmm. I tested it by intentionally leaving some files open that had not been saved. When I clicked the Restart Now option the computer immediately restarted and the files were lost. For now I have told my test group that they can slide the window aside and save/close any files.

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

Interesting! What OS are you running (and what app was open)? You could try changing aevtrlgo to aevtlogo which should do the full 'are you sure you want to log out' thing.

from jss.

scottlep avatar scottlep commented on August 22, 2024

The test was on a machine running 10.12.6 with TextEdit open with some unsaved files.

As far as the change you mention, where would I be making that?

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

For what it's worth, running this in a terminal behaves like I described above (Excel and Word, for example, ask me if I want to save unsaved work). I guess it might depend on how the app handles whatever request the system sends it...

osascript -e 'tell application "loginwindow" to «event aevtrlgo»'

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

You'd make the change on line 325:

subprocess.call([ 'sudo', '-u', user, 'osascript', '-e', u'tell application "loginwindow" to «event aevtrlgo»' ])

from jss.

scottlep avatar scottlep commented on August 22, 2024

Great. Thanks again for the quick responses. I will do a few more tests and report back.

Thx,
Scott

from jss.

scottlep avatar scottlep commented on August 22, 2024

I just tested using osascript -e 'tell application "loginwindow" to «event aevtrlgo»' via Terminal with a Pages file and TextEdit file open with unsaved changes. I was not prompted to save either file but when I logged back in to the machine and opened Pages and TextEdit they opened the unsaved files.

I tried the edited method by running osascript -e 'tell application "loginwindow" to «event aevtlogo»'. I was prompted by the are you sure you want to log-out window, but none of the open apps asked if I wanted to save the files but when I logged back in to the machine and opened Pages and TextEdit they opened the unsaved files.

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

Ah, OK, so perhaps apps that support auto-save (https://support.apple.com/en-gb/HT202255) will just never ask you, assuming that they'll always be able to restore your data.

from jss.

scottlep avatar scottlep commented on August 22, 2024

If I manually logout from the Apple Menu or command-shift-Q I am asked to save the files. I wonder what the difference is between how it is triggered in the script and how it is triggered from the finder?

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

I wonder what the difference is between how it is triggered in the script and how it is triggered from the finder?

You and me both! I'm sure there used to be detailed documentation about the logout process on the ADC site but I can't find it now :(

from jss.

scottlep avatar scottlep commented on August 22, 2024

I just tested it on a computer with Word, Textwrangler and other apps installed. When I did it with osascript -e 'tell application "loginwindow" to «event aevtlogo»' it asks to save the files for Word and Textwrangler. So I think you are correct about the apps that support autosave. That should work for our purposes.

from jss.

gkluoe avatar gkluoe commented on August 22, 2024

Cool - thanks a lot for opening the issue.. I'm sure this will make for useful documentation :-) Just shout if we can help further.

from jss.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.