From 479cd5896d9df73fa71a9f19a927af4510d6b8a4 Mon Sep 17 00:00:00 2001 From: Marcel Bischoff Date: Fri, 4 Dec 2015 00:39:20 +0100 Subject: [PATCH] Add launchagents.md and category link --- README.md | 69 +-------------------------- launchagents.md | 124 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 68 deletions(-) create mode 100644 launchagents.md diff --git a/README.md b/README.md index b776f12..0df9d2b 100644 --- a/README.md +++ b/README.md @@ -1122,75 +1122,8 @@ sudo kextunload -b com.apple.driver.ExampleBundle ### LaunchAgents -#### Periodical Job Template -Run job every 5 minutes. -```xml - - - - - Label - com.example.touchsomefile - ProgramArguments - - touch - /tmp/helloworld - - StartInterval - 300 - - -``` +Please see [this file](launchagents.md). -#### Periodical via Calendar Interval Job Template -```xml - - - - - Label - com.example.touchsomefile - ProgramArguments - - touch - /tmp/helloworld - - StartCalendarInterval - - Minute - 45 - Hour - 13 - Day - 7 - - - -``` - -#### Monitoring Folder Job Template -```xml - - - - - Label - com.example.watchhostconfig - ProgramArguments - - syslog - -s - -l - notice - somebody touched /etc/hostconfig - - WatchPaths - - /etc/hostconfig - - - -``` ### LaunchServices diff --git a/launchagents.md b/launchagents.md new file mode 100644 index 0000000..16acdbf --- /dev/null +++ b/launchagents.md @@ -0,0 +1,124 @@ + + +# LaunchAgents + +> An assorted collection of useful LaunchAgent examples. Part of [Awesome OS X Command Line](https://github.com/herrbischoff/awesome-osx-command-line). + +## Table of Contents + +- [Basic Examples](#basic-examples) +- [Homebrew](#homebrew) + +## Basic Examples + +### Periodical Job Template +Run job every 5 minutes. +```xml + + + + + Label + com.example.touchsomefile + ProgramArguments + + touch + /tmp/helloworld + + StartInterval + 300 + + +``` + +### Periodical via Calendar Interval Job Template +```xml + + + + + Label + com.example.touchsomefile + ProgramArguments + + touch + /tmp/helloworld + + StartCalendarInterval + + Minute + 45 + Hour + 13 + Day + 7 + + + +``` + +### Monitoring Folder Job Template +```xml + + + + + Label + com.example.watchhostconfig + ProgramArguments + + syslog + -s + -l + notice + somebody touched /etc/hostconfig + + WatchPaths + + /etc/hostconfig + + + +``` + + +## Homebrew + +### Periodic Homebrew Update and Upgrade +To leverage the notification system, this agent requires [terminal-notifier](https://github.com/julienXX/terminal-notifier), which can be installed via `brew install terminal-notifier`. +```xml + + + + + Label + com.example.homebrew-upgrade + ProcessType + Background + ProgramArguments + + /bin/sh + -c + /usr/local/bin/brew update && /usr/local/bin/brew upgrade && /usr/local/bin/terminal-notifier -title 'Homebrew Upgrader' -message 'Homebrew upgraded!' -appIcon http://cdn.curvve.com/wp-content/uploads/2013/09/homebrew_osx_logo.png + + RunAtLoad + + StandardErrorPath + /tmp/com.example.homebrew-upgrade.stderr + StandardOutPath + /tmp/com.example.homebrew-upgrade.stdout + StartCalendarInterval + + + Hour + 8 + + + + +``` + + +## License + +Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.