Schedule async in Mac OSX using launchd

Invocation of Aspera Sync on a pre-scheduled or periodic basis can be done using the specific scheduling facility of your operating system. In Mac OS X, launchd is the process that schedules execution of other tasks. It is equivalent to the cron facility found in most Linux and Unix systems, and the at service in Windows systems.

To have launchd start a process on a periodic basis, there must be a properties file in the LaunchAgents folder of the user that will own the process.

  • For ordinary system users, this must be placed in /Users/<user>/Library/LaunchAgents
  • For the system ("root") user, this must be placed in /Library/LaunchAgents

There is a sample properties file (async-starter.plist) attached at the bottom of this article that you can use for your Async scheduling.

If the attached sample file is placed in /Library/LaunchAgents as is, it will execute a second script at /usr/local/bin/start-async.sh as the user xfer every six minutes. You should change the values for the user, the script, and the time value in seconds to values appropriate to your deployment.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>async-starter</string>
<key>Program</key>
<string>/usr/local/bin/start-async.sh</string>
<key>UserName</key>
<string>xfer</string>
<key>StartInterval</key>
<integer>360</integer>
</dict>
</plist>

 

Caveats/Additional Background

Documentation of launchd can be viewed by opening the Terminal application on Mac OS X and executing the following command:

 man launchd

 

The user specific Library folder is typically "hidden" from the Mac OS X Finder application. It can be accessed via the command line in the Terminal application without issues. In some graphical applications, it is possible to show hidden files and folders in open and close dialogs using the keyboard combination Command-Shift-. ("Command-Shift-Period").

 

 

Attachments

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk