Skip to main content
Question

Policy: stop restart when script exit with non-zero code

  • April 20, 2026
  • 2 replies
  • 34 views

Stefan S

Hi all,

 

I have a policy running a script and restart options enabled. A restart message is also in place under “user interaction”. Everything is working fine so far. However, if the script is triggering an exit code other than 0, I want to stop the policy without restarting and showing the restarting window. Ist that possible? Or is there any workaround?

 

Thanks, Stefan

2 replies

Chubs
Forum|alt.badge.img+24
  • Jamf Heroes
  • April 20, 2026

If you want to do that, you’ll want to build it into your script. Use JAMF helper or swift dialog to build a prompt for reboot if your initial part of the script completes successfully. 


howie_isaacks
Forum|alt.badge.img+23
  • Esteemed Contributor
  • April 20, 2026

For the reboot, if you want to allow your users to save their work before rebooting, this has worked well for me: 

osascript -e 'tell app "loginwindow" to «event aevtrrst»'

Swift Dialog  is awesome. I use it when I need to create processes that are interactive.