Execute .run with parameters

Hi couminuty:

I´m tryinmg to execute a .run file in my client, its a instalation of an agent, accordnig with the documentation this the command for a silence instalation.

sh ./hcs-client-agent-4.2-12345.run install -y

In my action i have the nex code:

wait "/bin/bash" -c "sh ./home/bigfixapp/hcs-client-agent-4.2-13635.run install -y"

in the client’s log im geting exit code =127

what could be the problem ?

Thanks in advance

Any exit code comes from the application that is being run. You would have to check the .run for its exit codes as that is where any value would be coming from, or from sh or bash. The 127 code is a command not found. Both command lines are using the current directory as a reference but the “current directory” when running an action is the source site of the fixlet you ran.

The bash line is a bit confusing as well as you don’t really need to run sh again in the bash shell.

Thanks @AlanM i decided to create a script and execute it form bigfix and it worked very well, but i have a question about your replay.

What do you mean when you said “current directory” what is the path of that directory? what is the default path when the commands are executed ?

CWD will depend on the site and how you issued the action. It’ll be somthing like

Hi @JasonWalker thanks for your replay

I’m having a similar issue. Just a simple stoping of a service “callrec”

Command succeeded delete __appendfile (action:3481392)
Command succeeded appendfile #!/bin/sh (action:3481392)
Command succeeded (file created) appendfile #!/bin/sh (action:3481392)
Command succeeded appendfile #!/bin/sh (action:3481392)
Command succeeded appendfile cr stop callrec (action:3481392)
Command succeeded move __appendfile /myscript.sh (action:3481392)
Command started - wait chmod 755 /myscript.sh (action:3481392)
Command succeeded (Exit Code=0) wait chmod 755 /myscript.sh (action:3481392)
Command started - wait /myscript.sh (action:3481392)
Command succeeded (Exit Code=127) wait /myscript.sh (action:3481392

Exit code 127 and service doesn’t stop
any help would be greatly appreciated.

Same issue - exit code 127 in Linux means the executable was not found. BigFix is running without a shell environment, which seems to be a dependency for running shell scripts.

wait /bin/sh /myscript.sh

That explicitly invokes the shell to run the shell script.

1 Like

@JasonWalker , do i need to give complete path to the shell script ? if yes what will be the path ?

In my case there are two steps

  1. uploading the script to default BF __Download directory
  2. run the executable

The current working directory’ would be the current BES site folder, so

Wait /bin/sh __Download/myscript.sh

Thanks can i run command like below with double quotes ? will that work ?

“chmod u+x __Download/myscript.sh; /bin/sh __Download/myscript.sh install_start --token au:56644565654bf2-9653433432432423443aed-41c3wqwqewq-ae2b-c795c34343q38”

currently I am getting exit code 0 when running when i run , but the software does not get installed.

“chmod u+x agent_installer.sh; agent_installer.sh install_start --token au:56644565654bf2-9653433432432423443aed-41c3wqwqewq-ae2b-c795c34343q38”


This thread doesn’t use Distribution, but the usecase is very similar.

and how do i need to run this ? is this action script syntax ?

Yes, that is action script. If you’re not already familiar with it, then Distribution might be best.

@JasonWalker’s advice in this other thread might be instructive.

I suggest starting with a simple shell script that sends output to a file, so that you can see what’s going on when Distribution executes a shell script.

  1. Start with a script that only touches a file; does that work?
  2. Have the script print its working directory to an output file. That tells you the file path where Distribution executes from.
  3. Have the script print the location of the script itself. (You can do this with bash variables.)
  4. etc.

Having built the familiarity about Distribution’s shell environment, an adept shell scripter should be able to make the installer do what it needs.

(Unfortunately, I think you’ve discovered that using shell scripts with Distribution isn’t a common usecase on the forum.)