diff --git a/Library/LaunchAgents/com.github.erikw.restic-automatic-backup.plist b/Library/LaunchAgents/com.github.erikw.restic-automatic-backup.plist index e4021a5..5cf32db 100644 --- a/Library/LaunchAgents/com.github.erikw.restic-automatic-backup.plist +++ b/Library/LaunchAgents/com.github.erikw.restic-automatic-backup.plist @@ -6,12 +6,22 @@ Label com.github.erikw.restic-automatic-backup + EnvironmentVariables + + PATH + /usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + ProgramArguments /bin/bash -c - source /usr/local/etc/restic/erikw.env.sh && /usr/local/bin/restic_backup.sh + export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin && source /usr/local/etc/restic/erikw.env.sh && PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin /usr/local/bin/restic_backup.sh + + StandardOutPath + /Users/erikw/Library/Logs/restic/restic_stdout.log + StandardErrorPath + /Users/erikw/Library/Logs/restic/restic_stderr.log RunAtLoad @@ -24,15 +34,5 @@ 0 - EnvironmentVariables - - PATH - /usr/local/bin:/usr/bin:/bin - - - StandardOutPath - /Users/erikw/Library/Logs/restic/restic_stdout.txt - StandardErrorPath - /Users/erikw/Library/Logs/restic/restic_stderr.txt diff --git a/README.md b/README.md index 758fe8c..7986436 100644 --- a/README.md +++ b/README.md @@ -268,10 +268,21 @@ LaunchAgent is the modern service schedulerin in macOS that uses [Launchd](https ```console $ PREFIX=/usr/local make install-launchagent $ vim ~/Library/LaunchAgents/com.github.erikw.restic-automatic-backup.plist # Edit schedule if needed. +$ launchctl bootstrap gui/$UID ~/Library/LaunchAgents/com.github.erikw.restic-automatic-backup.plist $ launchctl enable gui/$UID/com.github.erikw.restic-automatic-backup $ launchctl kickstart -p gui/$UID/com.github.erikw.restic-automatic-backup ``` +Debug with +```console +$ sudo launchctl debug gui/$UID/com.github.erikw.restic-automatic-backup --stdout --stderr +``` + +TODO how disable? +``` +$ launchctl disable gui/$UID/com.github.erikw.restic-automatic-backup +$ launchctl bootout gui/$UID/com.github.erikw.restic-automatic-backup +``` ## Setup Cron If you want to run an all-classic cron job instead, do like this: