launchd login script doesnt work

68 Views Asked by At

I write the following 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.foo.foo1</string>
  <key>ProgramArguments</key>
  <array>
    <string>/Users/Shared/fooscript.sh</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

I add this plist file in /Library/LaunchAgents (so for all users).

the script (stored in /Users/Shared/)

#!/bin/bash
/bin/rm -rf /Users/Shared/filetodelete.docx

I try launchctl load com.foo.foo1.plist but nothing. I reboot my mac, but nothing. The file filetodelete.docx is on the mac.

the script has all rights 777 the com.foo.foo1.plist file has -rw-r--r-- (like all user plist files)

What could be the reason?

0

There are 0 best solutions below