Hello all, first time posting so please forgive if in wrong category.
I am trying to write an Action Script that will find the McAfee agent version and output it to a file. The linux script works on the linux system, but can’t get it to work all the way through with the Action Script.
Here is my Action Script:
// create a file with shell script commands using the “appendfile” action, for instance find the McAfee agent version, then output a file with results
appendfile #!/bin/sh
appendfile /opt/McAfee/agent/bin/cmdagent -i | sed “4,$ d” | sed “s/Version: //g” | sed -sn 3p > agent
// rename the script
move __appendfile agentscript
// give permissions to run the script
run chmod 777 agentscript
Hi brapoel,
I notices in the log that the fixlet is set as “Not Relevant”.
Are you writing a Fixlet or a Task ?
The Fixlet would fail if the applicability relevance is true after that the fixlet has run.
Does the command succeed if you run “sh agentscript” from the local command line ?
Why don’t you use bash instead of sh ?
I am running a fixlet. The command does not succeed, because the agentscript is never created (I haven’t seen it yet, or I am not looking in the correct place).
Note that this time the ActionScript has failed.
The wait command returned 127 ( command not found ).
Maybe the full path is required (/bin/bash or /usr/bin/bash).
The file is created under /var/opt/BESClient/__BESData/actionsite/
Try use this path to the bash command.
I see a couple of things to comment on there, but I don’t know whether any are your problem.
Where you create the output file ‘agent’, you aren’t setting a path to the output file. So it may end up in the ´BESClient/__BESData/sitename´ directory, which is periodically synced by the client - which will delete your output file.
Also, a good practice is to use ´delete __appendfile´ before creating it, to ensure there is no old content hanging around in the appendfile first.
When you execute the new script via bash, you are assuming it’s in the actionsite folder. The actual path can vary based on the operator (only a master operator updates the actionsite, and you really shouldn’t be using the master operator account to send client actions); the fixlet source site; and whether the action was targetted dynamically or statically. So generally you should either move the shell script to a known directory path, or use relevance substitution to generate the path such as ´{pathname of client folder of current site}/agentscript´