Comments (19)
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.
/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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
You'd make the change on line 325:
jss/coreconfig-softwareupdate-run.py
Line 325 in fe2b512
from jss.
Great. Thanks again for the quick responses. I will do a few more tests and report back.
Thx,
Scott
from jss.
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.
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.
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.
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.
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.
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)
- Applescript timeouts HOT 1
- coreconfig-softwareupdate-run: deferred updates should install on next logout
- coreconfig-softwareupdate-run: remove dependency on JAMFHelper if possible
- SoftwareUpdate.icns doesn't exist on 10.13 HOT 1
- Does this still work in 10.13.3? HOT 1
- Two problems with coreconfig-softwareupdate-run.py HOT 4
- jss/utilities-fix-file-names.sh HOT 1
- coreconfig-softwareupdate-run not working with 10.14.4 HOT 3
- We don't catch errors when setting the password HOT 2
- software_update_2019 non restart updates HOT 1
- General: make paths explicit
- SALT Help HOT 1
- userconfig-add-mdrive-favourite.sh needs working krb5.conf HOT 1
- Flash update script needs to be made more robust
- Include list in coreconfig-softwareupdate-run.py HOT 4
- coreconfig-softwareupdate-run: no updates installed if user defers reboot HOT 1
- coreconfig-softwareupdate-run: Pending updates are downloaded on every run
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jss.