Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Scripting OS X Launchd Agent to run a Backup Command

July 19, 2011 Leave a Comment

script-scp-backup

script-scp-backup

In OS X 10.7 the launchd process is the process that kicks off all processes and launches launch daemons and launch agents. This effectively is what cron and cronjobs are to the general Unix/Linux environment

Launch Daemons are typically system process whereas Launch Agents are processes that can be run by users.

Launch Daemons are found in 2 spots :

/Library/Launch/Daemons <<–3rd Party Daemons
/System/Library/Launch/Daemons <<–Apple Daemons

 Launch Agents are found in 4 spots:

/System/Library/LaunchAgents <<–Apple supplied agents for all users
/Network/Library/LaunchAgents <<–Network Users via an automount
/Library/LaunchAgents <<–Third party agents for all admins
~/Library/LaunchAgents <<–Third party agents for all users

These files are plain text xml files or  .plist “property list” files and are structured in value pairs, you can edit with a regular text editor or using Apple’s Property List Editor which comes in the Developer Tools: Developer/Application/Utilities, the files also have a reverse URL naming convention ie :

 com.neilgee.mysuperbackup.plist

A native plist looks like this:

<?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>com.neilgee.mysuperbackup</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/ftpcpanel.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>10</integer>
<key>Minute</key>
<integer>17</integer>
</dict>
</dict>
</plist>

And a view via the Property List Editor looks like this:

property-list-editor-osx

property-list-editor-osx

 

The one that applies to any 3rd Party automation for users is the agents filed in the users folder in:
~/Library/LaunchAgents <<–Third party agents for all users

And a great application for creating Launch Agents graphically is an app called “Lingon” by Peter Borg which allows you to create a new agent, name it, point to the command you want to run, set the frequency interval and set and forget.

So if you already have a script made for backups to download a cPanel backup from a remote host you can set when that script is run and the backup is launched.

In Lingon fill out the steps 1 2 and 3…

 

lingon-script-osx-backup

lingon-script-osx-backup

Cats: macOS Tags: backup, cron, launchd, lingon, lion, OSX, scripting

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS ars technica

  • Musi says evidence shows Apple conspired with music industry on App Store ban
  • Trump threatens Apple with 25% tariff to force iPhone manufacturing into US
  • I helped a lost dog’s AirTag ping its owner: An ode to replaceable batteries
  • Apple legend Jony Ive takes control of OpenAI’s design future
  • Epic goes to court to force Fortnite back on US iOS

RSS mac surfer

  • Tot is new text editor for Mac, iPhone, and iPad focused on constraints and ease of use
  • TiPbITS: Google Drive Sorting Can Hide New Documents
  • How to take a screenshot on a MacBook Pro
  • How To Create Simple Animation With Mac Keynote
  • Last Week on My Mac: Virus pandemics

Donate

Copyright © 2025· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2025 · gee on Genesis Framework · WordPress · Log in