0
我寫了一個代理來監視關鍵的系統文件:AG1-launchagentsPLIST似乎是正確的,但執行不顯示結果
#!/bin/bash
arg1=/System/Library/LaunchAgents
fswatch $arg1 "growlnotify -n "FSWatch" -m "FSWATCH:Changed:$arg1" -s"
我創建的相同文件的其他6個目錄seperately監視他們的變化和打印通過growlnotify通知。這些腳本使用命令行可以很好地工作。
下一步將是通過*的.plist文件自動啓動的AG1-AG7:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.fswatch</string>
<key>ProgramArguments</key>
<array>
<string>/Library/Scripts/Shell/ag1-launchagent.sh</string>
<string>/Library/Scripts/Shell/ag2-launchdaemons.sh</string>
<string>/Library/Scripts/Shell/ag3-bin.sh</string>
<string>/Library/Scripts/Shell/ag4-etc.sh</string>
<string>/Library/Scripts/Shell/ag5-usrbin.sh</string>
<string>/Library/Scripts/Shell/ag6-usrsbin.sh</string>
<string>/Library/Scripts/Shell/ag7-sbin.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>Nice</key>
<integer>10</integer>
<key>KeepAlive</key>
<false/>
<key>AbandonProcessGroup</key>
<true/>
</dict>
</plist>
但它不工作。
plist似乎是正確的。我通過plutil檢查了它。但是,每當我通過launchctl load * .plist運行plist並更改代理應該遵守的任何文件夾時,我都沒有收到單個通知。
注:我試着用ProgramArguments塊中的一行代碼,只啓動一個* .sh文件。但它也沒有效果。
對此有何看法?