Posted on 10-20-2013 09:58 AM
Is there a way to have the policy execution status be "failed" if the script within the policy fails a test?
I have a policy that runs a script. At the end of the script I test to see if it was successful. How do I pass its failure to the policy so that it indicates the scripts success or not? I played with exit values on the script, but the policy still states it successful no matter if it passed the test or not.
Thanks, Gretchen
Solved! Go to Solution.
Posted on 10-20-2013 11:02 AM
@kuwaharg / Gretchen
the trick is to echo something like "error" or "failure" in the script when you detect the success or failure of the scripts results, which gets picked up by the policy. Anything echoed to stdout gets captured in the policy log. If it sees those words, it will note the policy as having failed. This should also be noted in a Self Service policy to the end user running it.
Note that Casper Suite version 9 changed this a little according to release notes, so I don't know if the above still works there, or if you'd need to do something else. But the above steps will work in version 8.x.
Posted on 10-20-2013 11:02 AM
@kuwaharg / Gretchen
the trick is to echo something like "error" or "failure" in the script when you detect the success or failure of the scripts results, which gets picked up by the policy. Anything echoed to stdout gets captured in the policy log. If it sees those words, it will note the policy as having failed. This should also be noted in a Self Service policy to the end user running it.
Note that Casper Suite version 9 changed this a little according to release notes, so I don't know if the above still works there, or if you'd need to do something else. But the above steps will work in version 8.x.
Posted on 10-20-2013 02:11 PM
Thanks for your help Mike! That works for my 8.x environment.