Home Forums OS X Server and Client Discussion Questions and Answers launchd WatchPaths not triggered by CGI file change

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #371911
    hsthompson
    Participant

    I’m posting somewhat off-topic here, since I’m using Mac OS X client instead of server; but the reason is that I found extensive information on this site about the subject that brings me here today: launchd. Please feel free to move or delete this thread if it violates the rules.

    I have a Launch Agent watching a directory (WatchPaths). When a file is added, removed, or altered by user interaction, the Agent is triggered. However, I need it to be triggered by updates being made by a CGI script — which it is not currently doing.

    Mac OS X 10.4.10 Client
    Intel Mac Mini 2.0

    #371912
    khiltd
    Participant

    What does the script actually do?

    #371914
    hsthompson
    Participant

    [QUOTE][u]Quote by: khiltd[/u][p]What does the script actually do? [/p][/QUOTE]
    It is an rsync command:
    [code]#! /bin/sh
    rsync -avz –delete-after ~/Desktop/testfolder [email protected]:./public_html/[/code]

    #371920
    khiltd
    Participant

    And launchd is watching which path in that script?

    #371921
    hsthompson
    Participant

    It’s watching the local directory, ~/Desktop/testfolder.

    #371922
    khiltd
    Participant

    10.4 had a bug that required the filesystem object being “watched” exist in a permanent way. If this is a directory you’re creating and deleting dynamically, it won’t work on 10.4. If it is persistent then I’d probably have to see the plist and suggest manually touching the directory after rsync completes to see if that helps anything.

    #371927
    hsthompson
    Participant

    OK, here’s the plist.

    [code]

    Label
    com.myname.mylaunchd
    LowPriorityIO
    OnDemand
    ProgramArguments

    /Users/myuser/myscript.sh

    WatchPaths

    /Users/myuser/Sites/mysite

    [/code]

    #371928
    khiltd
    Participant

    Well, you said it was watching ~/Desktop/testfolder, but that plist clearly indicates it’s watching ~/Sites/mysite.

    #371931
    hsthompson
    Participant

    Sorry — I’ve been jumping between tests of the implementation. The basic XML is the same between them, but the directories are different.

    #371934
    khiltd
    Participant

    If you’re positive you’re loading the right job then touching the directory is all I can think of off the top of my head.

    I’m not entirely sure if it will actually swallow a directory now that I think about it–may be restricted to actual files. Can’t remember if it’s supposed to work or not in 10.4.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Comments are closed