Using a fixlet to run scripts on the target device.

Hello all,

I guess this is a general scripting questions as much as a BigFix question. I am attempting to use a fixlet to run a script which is already on the target server. So my fixlet consists of just a sh script that reads:

#!/bin/sh
. /opt/oracle/scripts/7-DAYADMIN/checkACI.sh

This does run the script on the target server, but only partially. Once that script hits a line that executes another script(located in the same directory as the checkACI.sh script), it seems to fail. This results in failure to update a file that should be updated by the CheckACI.sh script. So it’s like
BigFix script -> Script on device :heavy_check_mark:
Script on device -> another script on device :x:

Assuming that this was a file permissions issue (as in, BigFix lacks the permission to execute the secondary scripts on the device) I attempted to add a line like “chmod -R +x /opt/oracle/scripts/7-DAYADMIN/” but this just results in the script failing entirely.

Any guidance would be very appreciated.

That’ll be somewhat difficult to troubleshoot without knowing what either script does, but I could point out a couple of common issues…

Could be that one of the scripts is making an incorrect assumption about the ‘current working directory’. The working directory’ will not be the path of the script, but the /var/opt/BESClient/__BESData/sitename directory. One of your scripts may need to cd into another directory to make relative paths work.

Also if either script relies on an environment variable, the environment of the BESClient process may not have all the variables you expect, as it is a non-login shell and may not have processed files like .login or .bashrc

You might try outputting the stdout and stderr to see what, if any, error messages are displayed. I’m away from the computer at the moment, but likely change your script line from

. /opt/oracle/scripts/7-DAYADMIN/checkACI.sh

To

/bin/sh -x /opt/oracle/scripts/7-DAYADMIN/checkACI.sh > /tmp/script-output.txt 2>&1

Then read the script-output.txt file to see where processing stops and what message is displayed.

1 Like

Thank you, Jason. The tip about directing output to a txt file was very helpful. Through that we noticed that output that should have been directed there wasn’t showing up, meaning some scripts just weren’t being run. I added a “wait” command to the fixlet so that it waits for the subsequent scripts to finish before terminating, and that seems to have done the trick.

1 Like