How to Automate Backup of PFsense Configuration Using CRON
mohamednasr last edited by
This is a tutorial on how to automate backups of PFsense configuration Using CRON.
The Steps below have been tested more than 3 times and are working fine:
1- Install CRON using PFsense Package Manager ( Mine is version 0.3.7_2)
2- Create a named "backup" on pfsense root folder. I used WinSCP Software to access the root directory on pfsense but you can always use SSH. And keep in mind that you have to allow SSH access on PFsense from System > Advanced > Admin Access > Secure Shell
3- create a file named "backup_firewall_config.sh" and don't forget to give on both the backup folder and the script.
This is the script that will be used to backup pfsense configuration.
4- The body of my script is as follows:
scp $REMOTECONFIG $BACKUPDEST
5- Add a cron Job from PFsense Menu "Services" > CRON
mine is as follows:
0 1 * * * root /backup/backup_firewall_config.sh >>/backup/result.txt 2>&1
I hope this helps someone out.
I have an update for this script that can upload your configuration to a remote ftp site In case someone wanted to ask for it.
FearNaBoinne last edited by
@mohamednasr I am 100% positive that things are missing in this script, and just to test it I followed the steps, and it indeed did NOT work AT ALL...
Perhaps you can revisit this and verify what parts are missing? I can identify at least missing back-quotes (`) around the date section and the setting of $REMOTECONFIG, but somewhere, somehow the backup itself also need to be made, I think?