- CheckMates
- :
- Products
- :
- Quantum
- :
- Management
- :
- Re: FWM Command in bash script
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
CET (Europe) Timezone Course Scheduled for July 1-2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks this solved my issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bryce - this helped me out finishing a script today and having issues with the same error Dominik had, but on R80.20.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys
i've just updated VSX R80.30 to R80.40 but the script doesn't work into crontab
Here the script:
#!/bin/bash -f
#
#
source /etc/profile.d/vsenv.sh;
vsenv 4
cphaprob state | grep local | grep ACTIVE >> /dev/null
if [ $? -eq 0 ]; then
echo "--- Vpn user counter ---" > /tmp/userc_users
fw tab -t userc_users -s > /tmp/userc_users
source /etc/profile.d/vsenv.sh;
vsenv 0
# Leggo il file temporaneo e mando il contenuto via mail
cat /tmp/userc_users | $FWDIR/bin/sendmail -s 'Test' -t 10.79.226.17 -f xxxx@yyy.it wwww@yyy.it
else
exit
fi
If i launc manually works
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try to replace:
#!/bin/bash -f
with:
#!/bin/bash
