I’ve created a task that is used to try to help speed up the manual process of bringing down in-house applications when we do out patching cycle for Red Hat servers. Because there are so many different scripts to be run and not all systems need to run all scripts, I have “if” statements that define if the command exists and the computer name is a certain name then run the script else move on. During our test we found that most of the relevance clauses were causing the task to fail because of “Relevance substitution error”. My statement is as follows:
if {exists "script.ksh" of folder "/path/to/script" AND computer name = "nameofcomputer"}
wait script.ksh
endif
Am I missing something? Why would it fail on that?
if {exists file "start_ohs" of folder "/orabase/dba_scripts" AND computer name does not contain "wla01"}
wait su - oracle -c "/orabase/dba_scripts/start_ohs > /tmp/start_ohs.txt"
endif
If the file or folder don’t exist, it will throw an error because the relevance is singular. Try:
if {exists files "start_ohs" of folders "/orabase/dba_scripts" AND computer name does not contain "wla01"}
wait su - oracle -c "/orabase/dba_scripts/start_ohs > /tmp/start_ohs.txt"
endif
I tried what I wrote on my Mac (where these folders don’t exist at all) and got a False. The whose should absorb some of the errors here if that’s what you are meaning
… or just check for the existence of the fully qualified file since it’s already known. No errors will be thrown if any folder in the path doesn’t exist.
if {exists file “/orabase/dba_scripts/start_ohs” AND computer name does not contain “wla01”}