Candela Technologies Logo
Network Testing and Emulation Solutions

Remove old Reports and Data

Goal: Find and remove old reports and test data.

Running tests on LANforge for long periods of time can leave a lot of data behind. The check_expired_data.bash script can find old files to delete.This file is similar to check_large_files.bash but looks at the age of files.Introduced in LANforge 5.4.5.
  1. Download the script

    Download the script if it is not in /home/lanforge/scripts already. If you need to download the script, use the following commands:
    1. cd /home/lanforge/scripts
    2. wget
    3. chmod +x check_expired_data.bash
  2. Find the script help

    ./check_expired_data.bash -h
    -d  Find data within this directory (required)
    -t Find data this many days old or older (required)
    -f Delete files (not a default option)
    -v Print files

    See the files you would delete:
    ./check_expired_data.bash -d /home/lanforge/report-data -t 11 -v

    Actually delete the files:
    ./check_expired_data.bash -d /home/lanforge/report-data -t 11 -f

    You may create a script in /etc/cron.daily like this:
    ----- ----- ----- ----- ----- ----- ----- ----- -----
    $E -d $LF/report-data -t 11 -f
    $E -d $LF/html-reports -t 11 -f
    ----- ----- ----- ----- ----- ----- ----- ----- -----
  3. Running the script is likely places

    Places we would expect large amounts of files to be saved include:
    1. /home/lanforge/Documents
    2. /home/lanforge/lf_data
    3. /home/lanforge/report-data
    4. /home/lanforge/html-reports
    5. /home/lanforge/Downloads
  4. Survey where your data

    You can use the df command to get an idea where data is accumulating. Example:df -s * | sort -n | tail
     12736    interop-5.4.5.apk 
    22164 btserver
    23500 MonkeyRemote-0.4-shaded.jar
    39500 gua.64
    116536 local
    190444 LANforgeServer-5.4.4
    210004 LANforgeServer-5.4.5
    262628 LANforgeGUI_5.4.4
    267344 backup-lanforge-gui.tar
    269196 LANforgeGUI_5.4.5
  5. Please Avoid...

    Please avoid running the script in the /home/lanforge directory itself. A command like ./check_expired_data.bash -d /home/lanforge -t 10 -f would delete your LANforge Server, LANforge GUI and your saved scenarios.

    Packet Capture Files

    If you are saving PCAP files, please save them in /home/lanforge/Documents or/home/lanforge/report-data. Please do not save them in /home/lanforge. The check_expired_data.bash script should not be run with -d /home/lanforge it is too destructive.

    Also avoid:

    1. /
    2. /boot
    3. /etc
    4. /home
    5. /lib
    6. /opt
    7. /run
    8. /usr
    9. /root
    10. /var/log
    11. /var/cache
    12. /var/spool
    13. /var/www
    14. /var/run
  6. Creating a cronjob

    As the help text indicates, you can copy those lines into a cron job task that can run daily.
    1. sudo -s
    2. cd /etc/cron.daily
    3. nano expired_data.bash
    4. Copy in your script data and adjust:
      $E -d $LF/report-data -t 11 -f
      $E -d $LF/html-reports -t 11 -f
    5. chmod +x expired_data.bash
    6. Check for errors by running it by hand:
    7. ./expired_data.bash

Candela  Technologies, 2417 Main Street, Suite 201, Ferndale, WA 98248, USA | | +1.360.380.1618
Facebook | LinkedIn | Blog