1

I want to use the following plist to run a backup script under macos High Sierra.

File name: com.pollux.backup.plist

Content:

<?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.pollux.backup.plist</string>
    <key>ProgramArguments</key>
    <array>
     <string>sh</string>
     <string>-c</string>
     <string>/bin/backup_pollux_server</string>
     <key>KeepAlive</key>
     </array>
     <key>RunAtLoad</key>
     <true/>
     <key>StartInterval</key>
     <integer>3600</integer>
     <key>StandardErrorPath</key>
     <string>/tmp/pollux_backup.err</string>
     <key>StandardOutPath</key>
     <string>/tmp/pollux_backup.out</string>
  </dict>
</plist>

Permissions: -rw-r--r--@ 1 root wheel 694 3 Apr 19:57 com.pollux.backup.plist

I use the same script and plist to backup my wife’s MacBook (Mavericks). It runs flawlessly. But when I try to load it with launchctl at my MacBook I get the following error message:

/Library/LaunchDaemons/com.pollux.backup.plist: Invalid property list

I checked the plist with plutil:

LaunchDaemons pollux$ plutil com.pollux.backup.plist
com.pollux.backup.plist: OK

xmllint just shows the content of the plist.

I switched off the SIP:

LaunchDaemons pollux$ csrutil status
System Integrity Protection status: disabled.

Does anyone have an idea what to try next?

  • Your Program Arguments shouldn't have a <KeepAlive> key as it's not an argument. Also, you're calling a shell to run a script. Why not just run a script? Finally, why are you disabling SIP? Have a look at this launchd tutorial – Allan Apr 3 at 20:01
  • @Allan, I disabled SIP because of that tutorial. It’s mentioned unter "Troubleshooting". – pollux Apr 3 at 20:54
  • @klanomath, thanks a lot, changing the label helped. Do you have an idea why it still works under Mavericks? – pollux Apr 3 at 20:58
  • Oh, no, it wasn’t the label. It was a missing <true/> for KeepAlive. Now it works. Thanks a lot erverybody! – pollux Apr 3 at 21:03
  • @klanomath, I tried to do so, but I couldn’t figure out, how I can format code in comments. The code fences mentioned here didn’t work. – pollux Apr 3 at 21:36
1

The key KeepAlive had to be removed from the ProgramArguments array and properly enabled (<true/>).

This is how it works now:

<?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.pollux.backup</string>
    <key>ProgramArguments</key>
    <array>
     <string>sh</string>
     <string>-c</string>
     <string>/bin/backup_pollux_server</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
     <key>KeepAlive</key>
     <true/>
     <key>StartInterval</key>
     <integer>3600</integer>
     <key>StandardErrorPath</key>
     <string>/tmp/pollux_backup.err</string>
     <key>StandardOutPath</key>
     <string>/tmp/pollux_backup.out</string>
  </dict>
</plist>
| improve this answer | |
  • <string>com.pollux.backup</string> and <string>com.pollux.backup.plist</string> work. It makes no difference. – pollux Apr 4 at 11:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .