0

我写了以下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>

我将此 plist 文件添加到 /Library/LaunchAgents 中(因此适用于所有用户)。

脚本(存储在 /Users/Shared/ 中)

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

我尝试launchctl load com.foo.foo1.plist 但没有。我重新启动我的mac,但没有。文件 filetodelete.docx 在 mac 上。

该脚本拥有所有权利 777 com.foo.foo1.plist 文件具有 -rw-r--r-- (与所有用户 plist 文件一样)

可能是什么原因?

4

0 回答 0