The LANforge server and client save data and reports in different places:
This is the manager node. (If you have just one system it is both a manager and a resource.)
The LANforge software that can generate report output could be:
/home/lanforge/html-reports: the HTML and PDF reports/home/lanforge/report-data: this is the folder holding CSV data and Wireshark capture data (PCAPs)./home/lanforge/lf_reports: this folder is an older default location for saving CSV data for the GUI tabs (Port, Layer 3, Layer 4-7, etc).C:\Users\bob\Desktop or your C:\Users\bob\git\lanforge-scripts\py-scripts directory.html-reports directory where the GUI runs.lf_kinstall.pl --install_large_file_cron: creates a cronjob that removes files. This calls check_large_files.bash -a and will remove some files.check_large_files.bash: this script removes a variety of files:Your automation scripts can produce data in at least two of these areas (typically the report-data, html-reports and sometimes the lf_reports dirs.)
Your Linux OS comes with a few areas that can help automate the removal of those files.
Systemd timers and services are somewhat simpler to understand because there is less strange syntax. You need to create both a service and timer file to for the job.
This legacy service has been with us for some time; it enables system-scope and user-scope scripts to run on a regular basis. Some of of the notable places you can find crontab scripts:
/var/spool/cron/<user> - a user's crontab/etc/crontab - one file that the root user can edit/etc/cron.d - a directory of files that a root user can add scripts to/etc/cron.(hourly|daily|weekly|monthly) - where root can place other scriptscrontab -e or crontab -u lanforge -e.
Crontab syntax is easily searched for. Please ask support@candelatech.com for help./home/lanforge/lfcustom_ctrl.bash file provides areas you can execute shell commands that will start immediately before the LANforge manager service starts.
There is a template script provided to edit. Please do not edit it without consulting Candelatech support (support@candelatech.com). The report data you want to purge is always time-sensitive: you probably want to avoid deleting collected data that is actively being collected by the test your are executing. It is prudent to consider how old the data you want to delete is.
Candela Technologies encourages you to save your report data to a safe location. LANforge systems are often operated for prolonged periods in high-temerature environments that shorten the life of SSDs.
The check_large_files.bash script has an option to compress the reports and data present.
Your team might benefit from compressing old output before deleting it in case you need it.
Below are some examples of how to script the removal of data:
Systemd timers operate systemd service units.
Create a bash script that removes the data you want to delete, /home/lanforgee/remove-data.sh
#!/bin/bash
find /home/lanforge/lf_reports -type f -mtime +1 -exec rm -f {} \;
Make the file executable with chmod +x remove-data.sh
Create a systemd service: /etc/systemd/system/remove-data.service
[Unit]
Description=Remmove report data older than one day
[Service] Type=oneshot ExecStart=/home/lanforge/remove-data.sh
3. Create a timer: `/etc/systemd/system/remove-data.timer`
[Unit] Description=Remove LANforge report data older than one day every week Unit=remove-data.service
[Timer] OnCalendar=weekly Persistent=true
[Install] WantedBy=timers.target
4. Inspect the settings:
```shell
systemd-analyze calendar weekly
The cron system is slowly being abandoned by Linux distributions. If you are familiar with the service, there's no harm in using it.
/home/lanforge/remove-data.sh#!/bin/bash
find /home/lanforge/lf_reports -type f -mtime +1 -exec rm -f {} \;
/etc/cron.weekly/sudo ln -s /home/lanforge/remove-data.sh /etc/cron.weekly/