Relevance substituion error in Action Script

(imported topic written by jeko1791)

Hi, I’m fairly new to relevance and action script but I’ve racked my brain over and over on this one. I can get this relevance to work fine in the Q&A but when I move it into my action script, it always fails, giving a relevance substitution error. This is on SUSE Linux 10.

I’m trying to grab a file that’s created earlier in the action and move it to a different folder.

appendfile mv “{pathname of file whose (name of it ends with “.mef3” AND modification time of it > now - 1*minute) of folder “/tmp”}” “{pathname of parent folder of client & “/__BESData/__URT”}”

Any ideas would be greatly appreciated.

(imported comment written by BenKus)

Hi jeko,

Here are some things I can think of that would cause the relevance substitution to fail:

  • if the file that matched the criteria didn’t exist
  • if more than one file matched the criteria
  • if the “.mef3” was capitalized
  • if the file was modified more than 1 minute ago

Ben

(imported comment written by jeko1791)

wll, the file doesn’t exist until the line above this one creates it. But the Action Script is failing before it even tries to execute the Action Script. How can I include this line for a file that hasn’t been created yet?

(imported comment written by BenKus)

I am a bit confused on exactly where it is failing… I think it would be useful to see the full relevance / actionscript along with the client logs that show the agent running the script or failing on a specific line.

Ben

(imported comment written by jeko1791)

Sorry, that would be helpful, huh? Here’s the full action script:

prefetch urt_extract_ibm.pl sha1:9268ee6e1c2af6655ff988638a91260bf7f7529e size:40877 http://MYIP:52311/Uploads/Utilities/urt_extract.pl

prefetch urt_extract_ibm.ksh sha1:17dd0e512246e087718091d0823992d62892259b size:44542 http://MYIP:52311/Uploads/Utilities/urt_extract.ksh

if {NOT exists folder “__URT” of parent folder of client folder of current site}

wait mkdir -p “{pathname of parent folder of client folder of current site}/__URT”

endif

delete __appendfile

delete run_URT.sh

appendfile rm -f /tmp/*.mef3

appendfile cd {pathname of client folder of current site}/__Download

appendfile chmod 500 urt_extract.pl

appendfile ./urt_extract.pl -customer SoT

  • appendfile mv “{pathname of file whose (name of it ends with “.mef3”) of folder “/tmp”}” {pathname of parent folder of client}/__BESData/__URT

move __appendfile run_URT.sh

wait sh ./run_URT.sh

if {NOT exists file whose (name of it ends with “.mef3” AND modification time of it > now - 1*minute) of folder (pathname of parent folder of client folder of current site & “/__URT”)}

delete __appendfile

delete run_URT.sh

appendfile rm -f /tmp/*.mef3

appendfile cd {pathname of client folder of current site}/__Download

appendfile chmod 500 urt_extract.ksh

appendfile ./urt_extract.ksh -c SoT

appendfile mv “{pathname of file whose (name of it ends with “.mef3”) of folder “/tmp”}” {pathname of parent folder of client}/__BESData/__URT

move __appendfile run_URT.sh

wait sh ./run_URT.sh

endif

When it fails it just says Relevance Substitution Error in the log next to the line above, that I put a *** before. I’ve also tried taking this line out entirely on the shell script and putting the :

wait mv xxx yyy

command at the end after the script runs to create the output file. This doesn’t generate a failure in the logs, and the Action completes successfully, but the output file never gets created. In fact, if I try to execute the run_URT.sh script manually as root, it tells me I don’t have permission to run it. I have to “chmod 500 run_URT.sh” to be able to execute it. I think Bigfix is running into this as well when it tries to run the “wait sh ./run_URT/sh” command above, so the output file is never being created.

Am I creating the script wrong? Not sure why it would not be executable to me.