Cronjobs act as a schedule for specific commands to be executed once or on a regular basis. On the Barracuda NextGen Firewall F-Series or Control Center, you can adjust default cronjobs or create your own cronjobs to run on an hourly, daily, weekly, monthly, or annual schedule. For example, every five minutes between 05:00 and 06:00, every other day of the week in May. When configuring a cronjob, it is recommended that you provide a description of it. Next, you must specify at least one command to be executed and schedule the times for the cronjobs to run.
In this article:
Configured cronjobs are saved to a crontab with a standard crontab syntax for all entries. The crontab must contain at least two factory-defined jobs pertaining to log file and statistics data management. Storage policies are written to the logstore.conf file. This file governs the way in which log files are treated.
Because the log file management program logstore is invoked by the cron daemon crond, include an appropriate entry for it into the crontab because it is important to reconcile the settings adopted for log storage with the times when logstore is run by crond. Barracuda Networks recommends that you run this program on a daily basis. An appropriate entry should thus be made into section Daily Schedule.
Configure a Cronjob
Configure a cronjob to run at specific times and/or intervals. For example, if you are creating a cronjob with a monthly schedule, you can schedule the cronjob to run either on specific days of the month or in a set interval of days.
- Go to CONFIGURATION > Full Configuration > Box > Advanced Configuration > System Scheduler.
- Click Lock.
- On the Schedule Parameters page, configure the key and value definitions of the environment variables to be referenced in the cronjob entry. You can add new entries or edit predefined variables. You can edit the following predefined variables:
- LOGCONF – Set to /opt/phion/config/active/logstore.conf.
- MAILTO – Left to blank.
SHELL – Set to/bin/bash.
When you reference variables in a cronjob entry, prepend them with $. These variables are intended to be used in conjunction with jobs and are directly interpreted by crond.
- To configure a cronjob, select one of the following options from the Configuration menu in the left navigation pane:
- Daily Schedule – Opens the section where you can configure cronjobs that are run on an hourly and daily basis.
- Monthly Schedule – Opens the section where you can configure cronjobs that are run on a weekly and monthly basis.
- Yearly Schedule – Opens the section where you can configure cronjobs that are run on a yearly basis.
- Generic Schedule – Opens the section where you can configure cronjobs that are run on a customized basis. Configuring cronjobs in this section requires a basic understanding of standard crontab syntax.
- Click OK.
- Click Send Changes and Activate.
The cronjob will be executed according to the specified time schedule. To check the log file to verify that the job was executed, use the command: cat /var/log/cat /phion0/logs/box_System_cron.log
Use the following procedure to view information on the firewall rule usage on a Barracuda NextGen Control Center in the firewall ruleset configuration.
- On the Barracuda NextGen Control Center, create a cronjob (Box > Advanced Configuration > System Scheduler) with the command: /opt/phion/bin/getobjstat &
Firewall objects will be collected by the Barracuda NextGen Control Center at the configured time. Because every box is polled only once at the configured time, the statistics for the affected system will not be refreshed until the box is reachable at the next collection process.
- Expand Information in the opened local ruleset on your Barracuda NextGen Control Center. The fetched statistics are read when selecting Reload Externals.
- Check the log file to verify that the job was executed.