Scheduling Shortcuts (on macOS Monterey)

Hi, I have just installed Monterey, and am I being stupid, but is there a built-in way to schedule a Shortcut to run at a specific time?

For instance, I want to create a Shortcut to ssh into a server and get some data at 4:00 am.

I’m sure I must have missed something obvious.

If not via Shortcuts then what are people using to fire Shortcuts on a Schedule (like Cron)?

1 Like

I would run the shortcut using shortcuts as a command line instruction from your scheduler of choice.

For a shortcut called “4 AM Actions”, I would use the following instruction.

shortcuts run "4 AM Actions"

Thanks, Stephen. I really appreciate that. I suspect a UI will come in a future update.

Out of interest what do you find the most reliable tool for scheduling this kind of script on an always-on Mac? I have tried various and have found Keyboard Maestro the most reliable.

The other one I got on with was LaunchControl which is a UI for launchd. But I found relying on the launchd to trigger things just failed too often.

1 Like

I also use Keyboard Maestro as it is very convenient to maintain as well as most of my scheduled automations are already in that app to begin with. I have a per Mac macro group specifically for scheduled actions to further make schedules easier to review than hunting them out across multiple groups.

How do you trigger a shortcut from Keyboard Maestro?

And is there a way to trigger a Keyboard Maestro macro with a Shortcut?

As noted above, you can trigger it from the command line. Shortcuts has a command line option (above), and Keyboard Maestro can run command line scripts. So you just do it as you would for any other command line scripting call.

If I had to run a Keyboard Maestro automation from a Shortcut, I’d probably use the macro’s URL trigger.

This screenshot illustrates both.

3 Likes

For running tasks at specific times the simplest way (for me) is to put them into cron, but I am already familiar with corn and its limitations, so it might not be the best tool for others. There is also the LaunchAgent / LaunchDaemon plist files which have their own set of features and limitations (overall, I would say cron is less capable).

Don’t forget cron was also deprecated by Apple back in Tiger (OS 10.4); so that’s over a decade and a half ago. Cron is a great tool to know, and even use on *nix platforms, but given its status, I don’t think anyone looking for a scheduler for macOS should start with cron :man_shrugging:t2:

True, but it will be quite difficult for them to actually remove it, and it will break a lot of things if they do. I look on this deprecation status as more of a “We’d really rather you used LaunchAgents, mkay?"

In case it is of use to you, or others, I recently created a Keyboard Maestro plugin for running shortcuts that hopefully makes it a little bit more user friendly in terms of use and ongoing maintainenance.

4 Likes