Ani kumar
Ani kumar

Reputation: 163

Best way to schedule script jobs (mostly Python) on Mac in a way similar to Windows Scheduler?

Windows Scheduler was a pretty hideous tool, but at least it had a GUI and tons of options to play around with (what to do if it fails, how long to retry, timing options, etc). I have a few python scripts I'd like to run on my mac with similar options (e.g. run every midnight, and ASAP after boot if mac was off at midnight), and cron through Terminal can't be my best option. Any suggestions?

Upvotes: 0

Views: 2057

Answers (3)

Gordon Davisson
Gordon Davisson

Reputation: 125998

launchd is the preferred way to autorun jobs on macOS. launchd jobs come in two kinds: Launch Agents (which run in regular user sessions, for logged-in users) and Launch Daemons (which run as root, independent of who is or isn't logged in). You can create them either by hand as XML property list files, or with a GUI program like Lingon.

Upvotes: 2

Diego Torres Milano
Diego Torres Milano

Reputation: 69368

Besides cron you can take a look at:

 at      executes commands at a specified time;

 atq     lists the user's pending jobs, unless the user is the superuser;
         in that case, everybody's jobs are listed;

 atrm    deletes jobs;

 batch   executes commands when system load levels permit; in other words,
         when the load average drops below _LOADAVG_MX (1.5), or the value
         specified in the invocation of atrun.

Upvotes: 2

Charles Carriere
Charles Carriere

Reputation: 389

I would check out Automator, Apple's built in gui for creating macros and other automated tasks. I have not used it much, but I believe you can trigger scripts from Calendar events.

Upvotes: 1

Related Questions