Other useful scripts

From CUC3
Revision as of 20:34, 10 May 2008 by import>Jss43
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A place to share scripts that could be useful in many areas.

scratchrestart.pl

A common issue is running over quota on the clusters, due to each calculation generating a large file (e.g. CPMD RESTART files). scratchrestart.pl attempts to solve this by searching recursively through the directory tree (from the working directory) and moving all files matching a regular expression to a scratch disk, leaving behind a symbolic link to the file's new location and leaving all other files untouched. Warning: you will be asked for confirmation *only* once.

# scratchrestart.pl --help
usage: scratchrestart.pl [regular expression]

Search all files matching the regular expression (default: RESTART) contained in the
the current directory and all subdirectories and move them to scratch, leaving behind a 
symbolic link to the file now in scratch.  The directory structure is preserved in scratch. 
e.g. The file /home/jss43/RUN/RESTART.1 is moved to /scratch/jss43/RUN/RESTART.1.
Files are only moved if they are not symbolic links, so it is safe to do multiple times 
(a run only moves the files that have been generated since the last run).