Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use launchd to schedule repeating tasks Apps
OS X uses a framework called launchd for "starting, stopping and managing daemons, applications, processes, and scripts." (Quote from Wikipedia.) You can use launchd to schedule any task you want to run at specific times or intervals.

Nathan Grigg has posted a simple, clear tutorial, Schedule jobs using launchd which gives an introduction into how this process works, and how you can use it to schedule repeated tasks on your Mac. You'll have to edit plist files, and you may want to install some third-party tools, but this can be useful if you want to set up your own tasks. You could use cron, but, as Grigg says, "Unlike cron, launchd does not assume that your computer is always running. So if your computer happens to be sleeping at the time a job is scheduled, it will run the job when it wakes up."

Another place to look is this tutorial no the Doug's AppleScripts for iTunes web site. Doug presents launchd as a way of running his Update Expired Podcasts script at regular intervals.
    •    
  • Currently 3.00 / 5
  You rated: 3 / 5 (7 votes cast)
 
[41,077 views]  

Use launchd to schedule repeating tasks | 8 comments | Create New Account
Click here to return to the 'Use launchd to schedule repeating tasks ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use launchd to schedule repeating tasks
Authored by: diamondsw on Jul 31, '12 08:40:12AM

A good article, but it completely skips over LaunchDaemons, which are critical for anything you want capable of running automatically. In a nutshell, LaunchDaemons are run by the system at startup (not login, like LaunchAgents) and so will always be running regardless of whether someone is logged in or not.



[ Reply to This | # ]
What things do YOU add to launchctl?
Authored by: lrivers on Jul 31, '12 11:01:12AM

I've become pretty familiar with LaunchServices running databases installed with homebrew and such. Package managers and installers typically set the services on set up.

What manual processes do you set up?



[ Reply to This | # ]
Use launchd to schedule repeating tasks
Authored by: Anonymous on Jul 31, '12 01:06:05PM

No mention of anacron (surely Apple didn't kick anacron out of Mouton Lion?) it also doesn't run at specific times, so equally more suited to running on home systems. Put your script somewhere, anywhere, then symlink it to /etc/cron.hourly/ or ...daily, ...weekly, ...monthly. Far simpler for simpler needs. (That said, I could do with something like launchd in RHEL...)



[ Reply to This | # ]
Use launchd to schedule repeating tasks
Authored by: bedouin on Jul 31, '12 01:56:04PM

Apple has been depreciating cron since 10.5. Where it stands now I don't know exactly, but last time I used it in OS X root could only set crontabs; for everyone else they would disappear on reboot.



[ Reply to This | # ]
Use launchd to schedule repeating tasks
Authored by: Vynce on Jul 31, '12 09:10:17PM
Check out Lingon if you want a GUI.

[ Reply to This | # ]
Use launchd to schedule repeating tasks
Authored by: boredofthis on Apr 16, '13 09:22:17AM

Edited on Apr 17, '13 07:30:15AM by boredofthis


[ Reply to This | # ]
Use launchd to schedule repeating tasks
Authored by: boredofthis on Apr 16, '13 09:32:29AM
I found LaunchD Task Scheduler to do exactly what I wanted. Saves me messing around with plist files! I want a job that would run on low priority I/O, this seems like the only app to do it for me.
Edited on Apr 17, '13 07:28:50AM by boredofthis


[ Reply to This | # ]
Use launchd to schedule repeating tasks
Authored by: boredofthis on Apr 17, '13 07:26:47AM

Edited on Apr 17, '13 07:29:40AM by boredofthis


[ Reply to This | # ]