How my LaunchD demon was setup

I switched to crontab now, and it seems to work much better, but before I was trying to run periodic job with this daemon setup.

From first-time-setup script


# How my LaunchD demon was setup

echo "* symlinking launch agent for hourly job"
mkdir -p $LIBRARY/LaunchAgents
mkdir -p $LOGS/HourlyJob
ln -nsf "$CLOUD_CONFIGS"/LaunchAgents/* "$LIBRARY/LaunchAgents"
if launchctl list com.max.hourly &>/dev/null; then
  echo "  * hourly job daemon is already loaded (skipping)"
  echo "  * loading hourly job daemon"
  launchctl load -w "$LIBRARY/LaunchAgents/com.max.hourly.plist"

Separate hourly-reload script

#!/usr/bin/env bash
launchctl unload -wF /Users/max/Library/LaunchAgents/com.max.hourly.plist && \
launchctl load -wF /Users/max/Library/LaunchAgents/com.max.hourly.plist

App folder hierarchy (in the Configurations dir) <- this is the bash script

(I added this app to Security & Privacy -> Full Disk Access right from this path.)

The LaunchAgent config in the LaunchAgents/com.max.hourly.plist (in the Configurations dir)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">







Code snippets in this post are covered by MIT License.

October 30, 2022