Skip to main content
Question

Force quitting application to shut down computer

  • January 6, 2020
  • 4 replies
  • 42 views

Forum|alt.badge.img+2

Has anybody successfully forced quit an application that a student left on and 'didn't save' their work so the computer could be shut down?

some apps are notoriously bad at quitting when there's something they think needs to be saved and this prevents the Mac from shutting down.

Any help would be appreciated!

4 replies

Forum|alt.badge.img+18
  • Contributor
  • January 6, 2020

It's absolutely possible, and directly killing the process (not sending a quit command to the app) works in every situation I've experienced.

Alternately, "shutdown -r now" will force an immediate restart regardless of what's running.


Forum|alt.badge.img+10
  • Valued Contributor
  • January 7, 2020

@fsteffy, I use the script on this post: https://www.jamf.com/jamf-nation/discussions/17649/force-quit-all-apps-script. I have computers that are scheduled to restart daily. Before the scheduled restart I created a policy that ran the script first.


Forum|alt.badge.img+21
  • Honored Contributor
  • August 4, 2021

@fsteffy, I use the script on this post: https://www.jamf.com/jamf-nation/discussions/17649/force-quit-all-apps-script. I have computers that are scheduled to restart daily. Before the scheduled restart I created a policy that ran the script first.


@joethedsa can you post you code, the script on the link provided does not work.


Forum|alt.badge.img+10
  • Valued Contributor
  • August 4, 2021

@joethedsa can you post you code, the script on the link provided does not work.


@tkimpton, Sure thing.  Here is the one that I use:

#!/bin/bash #Force quit all non-essential applications declare -a killPIDs killPIDs=$(ps axww -o pid,command | grep -v bash | grep [A]pplications/ | grep -v /bin/sh | grep -v [C]asper | grep -v [J]amf | grep -v [S]elf\\ Service | grep -v [M]cAfee | grep -v [V]ZAccess* | grep -v grep | awk '{print $1}') Kill said processes. for i in ${killPIDs[@]} do echo "Killing PID $i" kill -9 $i done exit 0