Cron is failing to run the AppleScript

applescriptcron

I have the following code in a text file (myfile.applescript):

#! /usr/bin/osascript
tell application "Google Chrome" to quit

I would like Chrome to shut down each night at 9:15PM, so I added the following cron task to crontab:

15 21 * * * ~/Desktop/myfile.applescript

Unfortunately, the script is not triggering. Any thoughts?

NOTE: I am aware I can use iCal to resolve this problem. However, I'd prefer to not clutter my calendar with a daily script-triggering event.

Best Answer

Cron has be deprecated on modern versions of OS X. Apple's suggestion is to use launchd instead. You will find Lingon to be a useful tool for creating launchd daemons.

If you would prefer to use iCal to launch the script, you can create a separate calendar for scripted event(s), and hide it from view. It will function, but your calendar view will not be cluttered.

enter image description here