내가 중요한 시스템 파일을 모니터하기 위해 에이전트를 썼다 보여줍니다 변경 및 인쇄에 별도로을 모니터링하는 내가 6 다른 디렉토리에 같은 파일을 만든PLIST는 올바른 보이지만 실행은 어떤 결과
#!/bin/bash
arg1=/System/Library/LaunchAgents
fswatch $arg1 "growlnotify -n "FSWatch" -m "FSWATCH:Changed:$arg1" -s"
AG1-launchagents 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를 실행할 때마다 에이전트가 준수해야하는 폴더를 변경하면 단일 알림이 표시되지 않습니다.
참고 : 하나의 * .sh 파일 만 시작하는 ProgramArguments 블록에서 한 줄로 시도했습니다. 그러나 그것도 작동하지 않았다.
그 의견이 있으십니까?