![]() |
Should it be executable or anything?
|
Quote:
domain.mycompany.plist for example |
Quote:
I notice for 10.5 that the onDemand has been deprecated Quote:
Quote:
|
I am not familiar with CGI scripts, but I get the impression that the script is modifying a file rather than moving files, Is this correct?
When I test a folder that is being watched, it will trigger if a file is moved To or From its path, but will not trigger if a file has been updated/modified This appears to be the intended behaviour for watchPaths. *edit* Maybe adding something like this to the end of the script.. Code:
mv /Users/username/Desktop/foo_folder/foo.txt /Users/username/Desktop/foo_folder/mvFolder/foo.txt;mv /Users/username/Desktop/foo_folder/mvFolder/foo.txt /Users/username/Desktop/foo_folder/foo.txt |
Quote:
|
Quote:
|
There's also a binary at /bin/wait4path which should provide the same (or similar) action. [see man wait4path]
From a very limited test last night, mine seems to stay asleep forever (well, longer than I felt like waiting). -HI- |
Quote:
Code:
#! /bin/sh |
Quote:
|
I was thinking, maybe an approach could be to to have one watchpath to look at the folder. when a new file is added it writes the path of the new file to a second watchpath which watches the files.
The second one should then trigger on changes the the file. I have tested parts of this idea and it seems it would work. The write part is the easy bit, Code:
defaults write ~/Library/LaunchAgents/watchpath "WatchPaths" -array-add '<string>/Users/username/Desktop/foo_folder/foo.file</string>' |
mark -- that's awesome. I tested watching the individual file, rather than the folder as I had been, and it does trigger launchd when the CGI edits the file. Keep me posted, and I'll research a solution, too.
|
This is the code I have been working on, to add into the (folder) watchpath plist.
Code:
#!/bin/bash*Note, I only have a small amount of knowledge of shell. **edit 1** Changed the find part to ignore hidden files **edit 2** added to the script, to cope with spaces in filenames. Also I have now tested this and it works. The folder watching watchpath plist calls this shell script when a new file is added. The shell in turn checks against the paths in the file watching watchpath plist and adds any that are not already in it. |
Looks good. I'll set set up a sandbox account and try it out later.
Thanks for your help, everybody! |
| All times are GMT -5. The time now is 05:44 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.