issues with launchd

Hi,
i need some help for two launchd agents.
first issue: the StartInterval is set to 30 minutes. But it runs always minutes before a whole hour, and it seems it cumulates minutes over time.

[code]<?xml version="1.0" encoding="UTF-8"?>

Label com.myscript.agent LowPriorityIO Program /usr/bin/osascript ProgramArguments osascript ~/Library/Scripts/myscript StartCalendarInterval Minute 30 StartInterval 1800 [/code] second issue: i tried to watch a folder for changes, but the agent does nothing. Are whitespaces a problem? i tried also 'W\ folder' but nothing changes

[code]<?xml version="1.0" encoding="UTF-8"?>

Label com.watch_folder.agent Program /usr/bin/osascript ProgramArguments osascript ~/Library/Application Support/W folder/my_sort.scpt WatchPaths ~/Downloads/Ressourcen/ [/code]

Hi,

issue #1

Consider the difference:
StartCalendarInterval is set to trigger the script every hour at h:30
StartInterval is set to trigger the script every 30 Minutes after the launchd agent has been loaded

issue#2

Space characters in paths don’t matter.
I recommend to specify always full paths starting with / and the watched path without trailing space

Hi StefanK!

#1
i tried to write a agent who has to run a script task every half hour- related to my real clock hour time, not to an arbitrary stop-watch time. So i thought naively, to insert the ‘StartInterval’ key to get the whole hour, because two ‘StartCalendarInterval’ or two different time fractions (Minute) aren’t possible to set, or i’m wrong?
If things aren’t adjustable in one plist, i probably have to create two agents to run my script at two different clock time moments ?

#2
i tried with full paths as you suggested, but things refuse to work yet.Previousely, i used the ‘QueueDirectories’ but this key worked like crazy (don’t laugh now) :rolleyes:, because this one acted on every front window, and not only on the one path i had specified before. (my test script was a simple Finder script)

Hi,

Here’s some notes:

gl,
kel

Hi kel,
what do you mean with Rem?

remove, remember ? osascript -e? scripts should execute also without the -e argument.

Hi Joy,

It’s just a reminder to myself to make the shell script (if you’re running one) executable.

gl,
kel

you can specify


   <key>StartCalendarInterval</key>
    <array>
        <dict>
            <key>Minute</key>
            <integer>0</integer>
        </dict>
        <dict>
            <key>Minute</key>
            <integer>30</integer>
        </dict>
    </array>

The syntax in the second property list file looks to be correct

If you’re having issues with running the script for the watch folder agent maybe you could strip out all of the osascript stuff and just export your script into a .app bundle and then run the executable of the .app as the program arguments.

example:


<key>ProgramArguments</key>
<array>
<string>/Applications/Chess.app/Contents/MacOS/Chess</string>
</array>