2

I don't know if there's an available app or perhaps a terminal command, but I'd like to forcibly shut down a specific application at a specific time, without the option to cancel.

I'd like it so I can choose the time.

To make a long story short, there's a game that's incredibly addicting and if I don't force quit it, I can totally see myself getting lost in it for extra hours.

I'd rather just have the application quit, regardless of where I am in the game, so I make sure to follow through on my allotted time period for playing.

There's something similar, but not entirely applicable here (The info here could help in forming an answer): How can I forcibly shut down my Mac at an appointed time?

1

You can quit apps with AppleScript, such as:

osascript -e "tell application 'Safari' to quit"

Therefore, you can add the following to your crontab (env EDITOR=nano crontab -e) to quit an app without saving at 17:30 every day:

30 17 * * * /usr/bin/osascript -e "tell application 'Safari' to quit saving no"

If you want to quit without saving, you can remove the saving no.
Alternatively, you can kill the process with /usr/bin/killall Safari.

4
  • nice, what is missing is the "Force Quit" as per OP.
    – Ruskes
    Sep 14 '14 at 16:07
  • @Buscar OP did not refer to the specific action of Force Quit and therefore I interpreted it as the equivalent of 'shutdown' for the answer to the linked question. Regardless, I've edited my answer to include a force quit.
    – grg
    Sep 14 '14 at 16:20
  • Thanks for the response ! So, lets say its 3:00 PM and I want the application to force quit, without saving, at 5:30 PM. Then, I go into the AppleScript editor and type: env EDITOR=nano crontab -e And press enter. Then, type: 17 30 * * * /usr/bin/osascript -e "tell application 'App Store' to quit" saving no Is that correct? Thanks again !
    – Snhorq
    Sep 16 '14 at 13:48
  • @Jacob I've edited my answer to clarify. saving no is part of AppleScript not osascript
    – grg
    Sep 16 '14 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .