Page 1 of 1
lf_script_action command nesting?
Posted: 21 Jul 2015, 09:14
by djmerlyn
I'm using a script with the lf_script_action trigger. In the script I'm attempting to call clamscan. I have written the script correctly as far as its functionality, and I can run it from the command prompt manually passing fake input to it and it works, but when csf runs my script the clamscan fails. I'm unable to figure out why though, and hoping for some insight from the csf side why it might not work. The entire script works except for the call to clamscan which is tucked in to a variable such as;
var=`clamscan "$1"`
Thanks for any insights on this.
Re: lf_script_action command nesting?
Posted: 21 Jul 2015, 09:17
by ForumAdmin
You should use the full path to binaries within scripts to ensure that PATH issues do not occur. It would also be better, if you have clamd running as root, to use clamdscan rather than clamscan.
Re: lf_script_action command nesting?
Posted: 21 Jul 2015, 22:55
by djmerlyn
Thank you for your reply. I tried using the full path as you've suggested but unfortunately although it still works when called directly from the prompt, when csf calls it, it appears to be parsing the command instead of taking the output of the script and displaying it. I've no idea why. I had expected it to run the command and display the results as it does via command line (whether directly or via script).
Can I know what command csf is using to call the script?
Re: lf_script_action command nesting?
Posted: 22 Jul 2015, 06:57
by djmerlyn
I switched my shebang from bash to sh and all is working. Fair enough.
Thanks again for your help.