Skip to main content
Question

Logout Script with the Option to Cancel logout


Forum|alt.badge.img+3

Is there a way you can write a bash script to bring up a Jamf helper option with 2 buttons? OK and Cancel.

With OK continuing on with the script and then logging out.

But if the user clicks cancel it would actually cancel the logout and put them back to the desktop?

5 replies

Forum|alt.badge.img+4
  • New Contributor
  • 5 replies
  • February 10, 2021

Hello, of course it is possible that a button in Jamfhelper performs a certain button action. Here is an example:

ELPER=$("$jamfHelper" -windowType utility -icon "$KeychainIcon" -title "Change Keychain password" -description "$Message" -button1 "OK" -button2 "Cancel" -cancelButton "2" -defaultButton 2) echo "Jamf Helper Exit Code: $HELPER" if [ "$HELPER" == "0" ] then

skeenan07
Forum|alt.badge.img+10
  • Contributor
  • 34 replies
  • February 10, 2021

I wrote an auto-logout script in zsh last month that prompts the user after a specified idle time and restarts the Mac. You can find the script here.


  • 0 replies
  • February 17, 2022
skeenan07 wrote:

I wrote an auto-logout script in zsh last month that prompts the user after a specified idle time and restarts the Mac. You can find the script here.


Excellent script @skeenan07 .  I've been looking at how to deal with the devices that are hanging due to open programs or something when I have the config file set to auto log out, so finding your post is fantastic.  How do you go about leveraging it within JAMF? is it run at login or set differently?  


skeenan07
Forum|alt.badge.img+10
  • Contributor
  • 34 replies
  • February 17, 2022
Anonymous wrote:

Excellent script @skeenan07 .  I've been looking at how to deal with the devices that are hanging due to open programs or something when I have the config file set to auto log out, so finding your post is fantastic.  How do you go about leveraging it within JAMF? is it run at login or set differently?  


Hey I created a package that drops the script at /Library/Scripts/autoLogout/ and a launch daemon in /Library/LaunchDaemons/. The launch daemon runs the script every five minutes to check the idle time. If it has exceeded the time, the script will display the popup and log out if the user does not respond. I have a post-install script in the package to load the launch daemon. In Jamf, I created a policy to install the package on some of our labs at their next check-in. I have more info here


  • 0 replies
  • February 17, 2022
skeenan07 wrote:

Hey I created a package that drops the script at /Library/Scripts/autoLogout/ and a launch daemon in /Library/LaunchDaemons/. The launch daemon runs the script every five minutes to check the idle time. If it has exceeded the time, the script will display the popup and log out if the user does not respond. I have a post-install script in the package to load the launch daemon. In Jamf, I created a policy to install the package on some of our labs at their next check-in. I have more info here


Thanks for the info and also for the links.  I was missing the LD portion.  Many thanks for your work on something like this, its semi mind numbing the work that goes into a simple boot out process...


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings