The Mac OS X system startup program launchd enables job scheduling (similar to cron.) By creating a launchd agent, one can trigger programs through one of the following events:
- an interval of time has elapsed
- a certain calendar date has come
- a file path has been modified
- something has been placed in a certain directory (queue directory)
- a volume has been mounted
I have previously relied on launchd to start a collection of Python scripts for automating an OS X system. However, since adding a new script also often requires the installation of a new launchd agent for starting it, I would like take launchd out of the equation. A Python program should wait and watch for events like those above to occur, then dispatch the appropriate routine.
Is there a Python module which is appropriate for detecting events like those above? Or, as a more general question, how can I replace launchd in this setting using Python (and possibly AppleScript via the AppScript bridge)? Sorry if the question is rather vague. Reading suggestions are also appreciated.