MacOS Launchd move files plist in Ventura not working

131 Views Asked by At

I am trying to schedule two zsh commands every 10 seconds

The plist

<?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.david.pdf</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/David/Tools/pdf.txt</string>
    </array>
    <key>StartInterval</key>
    <integer>10</integer>
</dict>
</plist>

And the script

#!/bin/zsh
mv ~/Library/Mobile\ Documents/iCloud~com~apple~iBooks/Documents/*.pdf ~/dropbox/reading/temp
mv ~/dropbox/*.pdf ~/dropbox/reading/temp

I'm wanting to copy all PDF files from Books and from the root of Dropbox, to a selected /Reading/Temp folder

My script does not work, with error 78.

Both work fine from terminal

What am I doing wrong.?

1

There are 1 best solutions below

4
TimD On

Try renaming your script and making it executable.

mv pdf.txt pdf.sh && chmod +x pdf.sh

Also, if launchd is anything like cron, then 10 seconds might be too short. Consider using 60 seconds minimum.