I wrote an agent to monitor critical system files: ag1-launchagents
#!/bin/bash
arg1=/System/Library/LaunchAgents
fswatch $arg1 "growlnotify -n "FSWatch" -m "FSWATCH:Changed:$arg1" -s"
I created the same file for 6 other directories to monitor them seperately for changes and to print the notifications via growlnotify. The scripts works perfectly fine using the command line.
The next step would be to autostart the ag1-ag7 via a *.plist file:
<?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>
But it doesnt work.
The plist seems to be correct. I checked it via plutil. But whenever i run the plist via launchctl load *.plist and change any of the folders the agents should observe, I do not get a single notification.
Note: I tried it with a single line in the ProgramArguments block, only starting one *.sh file. But it didn't work either.
Any thoughts on that?