Call: (480) 382-8464

Bash Script to SCP Old Log Files in Check Point

One issue that might show up with any type of server is filling up diskspace with log files. This bash script can be modified to SCP and remove any type of file, but this demo bash script is for Check Point Firewalls.

first, you’ll need to find the $FWDIR for your version:

echo $FWDIR

Here is the complete script to scp log files that are older than 30 days, then remove them



# If you want to script the SCP'ing of old files:
find $VERSION/log/*.* -type f -mtime +30 -exec scp {} admin@ \;

# And if you want to delete the files after you SCP them, there are two methods:
find $VERSION/log/*.* -type f -mtime +30 | while read i; do rm "$i"; done

And that's it. Schedule it with cron to test logs each day. If you want to automate it, you'll to setup ssh keys between servers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Main Offers/Services

Hosting and website related services offered by Digital Crunch:

Managed VPS Hosting

Server Updates, Module/Software Installs, Firewall, Security, Hosting Management, Wordpress - let us manage it for you

Hosted Email

Setup and Maintain Business Class, Secure Email Hosting including spam protection and 25GB of storage space

Linux Consulting

Server Updates, Module/Software Installs, Firewall, Security, Hosting, Wordpress and Apps, anything related to Linux

Email Marketing Services

We broadcast your content to your list, capture leads for you, follow up on schedules, make more sales for you

Website Maintenance

Content updates, menu changes, graphics changes, adding content, getting links, building traffic, building sales funnels

Hosting Tutorials

Tutorials we've written for other customers that like to get their hands dirty and learn about hosting