Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 

FWM Command in bash script

Hello,

I try to run a bash script as a schedules task (admin user) via Gaia on a R77.30 management server. The purpose of the script is to use the "fwm logexport" command to convert log files to ascii format and then move the file over scp to a Linux server. 

Everything works as expected when calling the script on the command line via expert mode. When the script runs from the cron job everything works the same except that the fwm command cannot be found. 

When I just use "fwm" as command in the script I get this error: "fwm: command not found"

When I try to specify the whole path "/opt/CPsuite-R77/fw1/bin/fwm" I get this error: "/opt/CPsuite-R77/fw1/bin/fwm: error while loading shared libraries: libcplic_cntrct.so: cannot open shared object file: No such file or directory"

Thanks in advanced,

Dominik

0 Kudos
5 Replies
Highlighted

Re: FWM Command in bash script

Do you have the following early on in your script to properly set the different Check Point environment variables including PATH:

source /opt/CPshrd-R77/tmp/.CPprofile.sh

or

source /opt/CPshrd-R77/tmp/.CPprofile.csh

--
Second Edition of my "Max Power" Firewall Book
Now Available at http://www.maxpowerfirewalls.com

Book "Max Power 2020: Check Point Firewall Performance Optimization" Third Edition
Now Available at www.maxpowerfirewalls.com
Highlighted

Re: FWM Command in bash script

Many thanks this solved my issue.

0 Kudos
Highlighted
Pearl

Re: FWM Command in bash script

I recommend to add the line below on top of your script:

source /etc/profile.d/CP.sh;‍

In case you also wish to create similar scripts on VSX systems, just add this line as well:

source /etc/profile.d/vsenv.sh;‍
Highlighted
Copper

Re: FWM Command in bash script

At the top of my cronjobs that require Checkpoint Environment Variables I use:

#Load Checkpoint Environment Variables
source /etc/profile.d/CP.sh
if [[ -e /etc/profile.d/vsenv.sh ]]; then
    source /etc/profile.d/vsenv.sh
fi

The outcome should be the same as what Tim provided.

Highlighted
Employee
Employee

Re: FWM Command in bash script

Thanks Bryce - this helped me out finishing a script today and having issues with the same error Dominik had, but on R80.20.

0 Kudos