diff --git a/Installomator.sh b/Installomator.sh index 9336284..21e4be9 100755 --- a/Installomator.sh +++ b/Installomator.sh @@ -34,6 +34,9 @@ NOTIFY=success BLOCKING_PROCESS_ACTION=prompt_user # options: # - ignore continue even when blocking processes are found +# - quit app will be told to quit nicely, if running +# - quit_kill told to quit twice, then it will be killed +# Could be great for service apps, if they do not respawn # - silent_fail exit script without prompt or installation # - prompt_user show a user dialog for each blocking process found # abort after three attempts to quit @@ -380,6 +383,18 @@ checkRunningProcesses() { appClosed=1 case $BLOCKING_PROCESS_ACTION in + quit|quit_kill) + printlog "telling app $x to quit" + runAsUser osascript -e "tell app \"$x\" to quit" + if [[ $i > 2 && $BLOCKING_PROCESS_ACTION = "quit_kill" ]]; then + printlog "Changing BLOCKING_PROCESS_ACTION to kill" + BLOCKING_PROCESS_ACTION=kill + else + # give the user a bit of time to quit apps + printlog "waiting 30 seconds for processes to quit" + sleep 30 + fi + ;; kill) printlog "killing process $x" pkill $x