Automator Quit All Applications can't kill Terminal

Is there a way to get around Terminal stopping the process and asking if I want to terminate the batch file I'm running? I'd like to have my Mac restart every night but I can't figure out how to stop Terminal.

iMac 21.5″, macOS 10.13

Posted on Mar 26, 2021 5:27 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 26, 2021 7:19 PM

This put the hammer to the terminal when I was running a background process.


killall Terminal


You would need to run the automater event to run a terminal command.


Here is an applescript to do the deed.


(* 


It is easier to diagnose problems with debug information. I suggest adding 
log statements to your script to see what is going on.  Here is an example.




	Author: rccharles
	
	For testing, run in the Script Editor.
	  1) Click on the Event Log tab to see the output from the log 
	      statement
	  2) Click on Run
	  
  For running shell commands see:
  http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
	




 *)




on run
	-- Write a message into the event log.
	log "  --- Starting on " & ((current date) as string) & " --- "
	--  debug lines
	set desktopPath to (path to desktop) as string
	log "desktopPath = " & desktopPath
	
	set toUnix to "killall Terminal"
	log "toUnix is " & toUnix
	try
		
		set fromUnix to do shell script toUnix
		log " fromUnix is" & fromUnix
		log "Goodbye Terminal"
	on error errMsg number n
		log "killall complaint is " & errMsg & " with number " & n
	end try
	
end run




2 replies
Question marked as Top-ranking reply

Mar 26, 2021 7:19 PM in response to h00pak

This put the hammer to the terminal when I was running a background process.


killall Terminal


You would need to run the automater event to run a terminal command.


Here is an applescript to do the deed.


(* 


It is easier to diagnose problems with debug information. I suggest adding 
log statements to your script to see what is going on.  Here is an example.




	Author: rccharles
	
	For testing, run in the Script Editor.
	  1) Click on the Event Log tab to see the output from the log 
	      statement
	  2) Click on Run
	  
  For running shell commands see:
  http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
	




 *)




on run
	-- Write a message into the event log.
	log "  --- Starting on " & ((current date) as string) & " --- "
	--  debug lines
	set desktopPath to (path to desktop) as string
	log "desktopPath = " & desktopPath
	
	set toUnix to "killall Terminal"
	log "toUnix is " & toUnix
	try
		
		set fromUnix to do shell script toUnix
		log " fromUnix is" & fromUnix
		log "Goodbye Terminal"
	on error errMsg number n
		log "killall complaint is " & errMsg & " with number " & n
	end try
	
end run




This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automator Quit All Applications can't kill Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.