Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Daily purge of older job work dirs

Pleiades has allocated us a quota of 100 TB and 5000000 files. This script finds and deletes all files older than 3-days 2.1 days and under each of the group id worker directories.

crontab that runs every night at 1:37am and 1:37pm Pacific Time:

Code Block
esi_sar@hfe1:~/github/hysds-hec-utils> crontab -l
37 1 * * * /home4/esi_sar/github/hysds-hec-utils/purge_old_files.sh
37 13 * * * /home4/esi_sar/github/hysds-hec-utils/purge_old_files.sh
Code Block
cat /home4/esi_sar/github/hysds-hec-utils/purge_old_files.sh

#!/usr/bin/env bash
find /nobackupp12/esi_sar/s2037/worker/ -type f -mtime +32.1 | xargs rm -f
find /nobackupp12/esi_sar/s2037/worker/ -type d -empty -delete
find /nobackupp12/esi_sar/s2252/worker/ -type f -mtime +32.1 | xargs rm -f
find /nobackupp12/esi_sar/s2252/worker/ -type d -empty -delete
find /nobackupp12/esi_sar/s2310/worker/ -type f -mtime +32.1 | xargs rm -f
find /nobackupp12/esi_sar/s2310/worker/ -type d -empty -delete

...