RSS Amplifier

Matt Gibson · Feb 25, 2023

UPDATED GOES removal script for Linux

0
Sign in to vote or save

Matt G · Matt Gibson

Recently I made this tutorial on receiving GOES images, and I had previously posted a little script for keeping everything clean. It’s now been updated slightly for new paths according to the howto I created.

Not very complicated. First create your script

    $ nano /home/radio/goes_remove_old.sh

Then, paste this in

    # DELETE FILES older than 7 days in the emwin directory
    find /var/www/html/goes/emwin/* -type f -mtime +7 -exec rm -f {} \;
    # DELETE ENTIRE DIRECTORIES older than 7 days and 14 days for NWS
    find /var/www/html/goes/goes16/m1/* -type d -mtime +7 -exec rm -rf  {} \;
    find /var/www/html/goes/goes16/m2/* -type d -mtime +7 -exec rm -rf  {} \;
    find /var/www/html/goes/goes16/non-cmip/* -type d -mtime +7 -exec rm -rf  {} \;
    find /var/www/html/goes/goes16/fd/* -type d -mtime +7 -exec rm -rf  {} \;
    find /var/www/html/goes/goes18/fd/* -type d -mtime +7 -exec rm -rf  {} \;
    find /var/www/html/goes/nws/* -type d -mtime +14 -exec rm -rf  {} \;

Exit and save the file. Then make it executable

    $ chmod +x goes_remove_old.sh

Now you can either cron this, or run it whenever you want.

Note you can just change the times from 7 days, or 14 days to whatever you want.

Read the original on mattgibson.ca

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.