• ">

    Launchd backup

    launchd is a unified, open source service management framework for starting, stopping and managing daemons, programs and scripts. The launchd daemon is essentially a replacement for init, rc, the init.d and rc.d scripts, SystemStarter (Mac OS X), inetd and xinetd, atd, crond and watchdogd. Apple has stated that it intends to eliminate all of the aforementioned services in favour of launchd.[1]

    In Mac OS X v10.4 Tiger, Apple introduced a new system startup program called launchd. The launchd daemon takes over many tasks from cron, xinetd, mach_init, and init. The launchd daemon offers a single, standardized, interface to any and all programs started automatically by the system. Furthermore, the configuration files that determine when to run a given program can also specify resource limits and environment variables, which simplifies setup and security for many programs. The same configuration file format is used whether a job is launched once at system startup or user login, on demand over the network, or at intervals.

    It is also possible to run additional copies of launchd, most often run by a non-root user. When non-root users load jobs, the launchd daemon handling their jobs runs with their non-root privileges, giving an extra layer of security.

    The launchd daemon also provides a performance boost to the system. At any given time, only those daemons that are actually used are launched; daemons can shut themselves down and be relaunched as needed means that average memory footprint of the system can be reduced.

    launchd Is just an XML document (called a "plist" because it sets preferences) that will run actions that were formerly the domain of cron and other system functions. "Plist" just stands for "Property List." A text editor such as TextWrangler (free) or Smultron (also free) can be used to draft an XML document, both of which are preferable to TextEdit.

    A Launch Daemon isn't just for use at launch time; it can be used ANYTIME. It's just LOADED at launch time.

    The launchd daemon offers a single, standardized, interface to any and all programs started automatically by the system. Furthermore, the configuration files that determine when to run a given program can also specify resource limits and environment variables, which simplifies setup and security for many programs. The same configuration file format is used whether a job is launched once at system startup or user login, on demand over the network, or at intervals.

    Launchd is responsible for launching processes at startup, login, at regular intervals, or on demand. The Activity Monitor application, set to view "All Processes, Hierarchically," will list two top-level processes: kernel_task, and launchd. The launchd spawns all the other processes.

    launchd file locations

    Launchd looks in five well-defined locations for launch-able items:

    • /System/Library/LaunchDaemons
    • /System/Library/LaunchAgents
    • /Library/LaunchDaemons
    • /Library/LaunchAgents
    • ~/Library/LaunchAgents

    Software for creating and editing launchd plists and shell scripts

    Software to make all this easier (all free)

    • Smultron or TextWrangler text editors
    • BatChmod permissions editor
    • Lingon launchd configuration editor

    References

    [1] Back up files in the background using launchd