I am developing a program that runs on a cluster and writes a lot of short bits. First, it outputs to the node's scratch directory; when it is done, it rsyncs the files to a hard drive and then removes them from scratch. Without this step, the program often gets stuck. I am on a RedHat cluster with Rocks.
The program isn't perfect, and during development, many users may leave orphaned unneeded files on scratch (they have already been rsync'd).
For my own files, I use this script to get rid of the orphaned files:
for i in {1..24}
do
ssh compute-0-$i "rm -rf /scratch/*`
done
However, I have the following questions:
- does this violate any "best practice" rules?
- to delete all files from all users whenever anyone runs it, must I
chmod -R a+rw /scratch
?