I created the plist
for a 'custom' backup agent (via LaunchAgent). The (zip) program is called, but I keep getting a 'zip error: Nothing to do!' in my logs.
I assume it has something todo with permissions. I did add sh
and zip
to my Full Disk Access
security settings. But it did not help.
On a side-note, when I move the zip command in a shell (sh) script, it works.
I would like to know why using the zip
command directly doesn't?
Running the command for the terminal works also without issues, like so:
/usr/bin/zip /Users/username/Backup/test.zip /Users/username/Documents/*.pdf
LaunchAgent script:
<?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.myuser.DailyBackup</string>
<key>Program</key>
<string>/usr/bin/zip</string>
<key>ProgramArguments</key>
<array>
<string>/Users/username/Backup/test.zip</string>
<string>/Users/username/Documents/*.pdf</string>
</array>
<key>StandardOutPath</key>
<string>/tmp/my.backup.log</string>
<key>StandardErrorPath</key>
<string>/tmp/my.backup.err</string>
<key>Debug</key>
<true/>
<key>StartInterval</key>
<integer>10</integer>
</dict>
</plist>
Best Answer
From
man launchd.plist
So you need to use
It still won't work though because
launchd
doesn't expand wildcards andzip
doesn't either. It's easier to uselaunchd
to start a shell script which does all the work then.