Trouble getting custom Action Sucess Criteria working

(imported topic written by murtasma91)

I have created a task that deploys a text file to the BigFix client directory. I’m trying to write a relevance statement to determine of the file has been modified recently. This is the following relevance clause I’m using.

(now - (modification time of file “{pathname of parent folder of client}{if (name of operating system starts with “Win”) then “” else “/”}power-exclusion.txt” )) < 10*minute

The first code “” is highlighted in red and I beleive this is what’s causing the problem. I need to input the correct backslash depending on the operating system since this task will be used on Windows and Mac workstations.

(imported comment written by NoahSalzman)

Let’s break it down… first you need to get your file path correct. Remove the curly braces (that’s for Action Script, not Relevance) and concatenate your file path. (Note that I’m in the Relevance Debugger, so the path is different.)

q: ((pathname of parent folder of client as string) & (if (name of operating system starts with “Win”) then “” else “/”) & “power-exclusion.txt”)

A: C:\Program Files\BigFix Enterprise\BES Console\QnA\power-exclusion.txt

Then, using the raw string, let’s build up our statement bit by bit to make sure there are no other bugs:

q: modification time of file “C:\Program Files\BigFix Enterprise\BES Console\QnA\power-exclusion.txt”

A: Fri, 12 Nov 2010 09:19:05 -0800

q: (now - (modification time of file (“C:\Program Files\BigFix Enterprise\BES Console\QnA\power-exclusion.txt”)))

A: 00:01:10

q: (now - (modification time of file (“C:\Program Files\BigFix Enterprise\BES Console\QnA\power-exclusion.txt”))) < 10*minute

A: True

q: (now - (modification time of file ((pathname of parent folder of client as string) & (if (name of operating system starts with “Win”) then “” else “/”) & “power-exclusion.txt”)))

A: 00:02:15

And finally:

q: (now - (modification time of file ((pathname of parent folder of client as string) & (if (name of operating system starts with “Win”) then “” else “/”) & “power-exclusion.txt”))) < 10*minute

A: True

(imported comment written by murtasma91)

Thanks for the clarification Noah it’s starting to make more sense now. I’ve tried evaulating the statements like you have shown and came up with the same results however after updating the relevance for the custom sucess criteria I noticed the statement should actually inverse.

“This action will be considered successful when the following relevance clause evaluates to false:”

I went ahead and made some additonal modifications to the relevance statement so it can handle a situation if the file doesn’t exist. I also reversed what’s returned back to the system so it would evaluate to false if the file was recently modified.

After running the task on my system the action always returns failed (even if it sucessfully modified the file).

Here is the updated relevance I’m using now.

if exist file((pathname of parent folder of client as string) & (if (name of operating system starts with “Win”) then “” else “/”) & “power-exclusion.txt”) then if (now - (modification time of file ((pathname of parent folder of client as string) & (if (name of operating system starts with “Win”) then “” else “/”) & “power-exclusion.txt”))) < 10*minute then false else true else true

When I run this statement using the 8.0 RelevanceDebugger I get the expected output. False if the file is present and recently modified and true if the file is not present or it hasen’t been modified in the last 10 minutes.

The following relevance always returns true when evaulating for the sucess criteria

(now - (modification time of file ((pathname of parent folder of client as string) & (if (name of operating system starts with “Win”) then “” else “/”) & “power-exclusion.txt”))) < 10*minute