Commit c8827ceb authored by Gary Wong's avatar Gary Wong
Browse files

Add a script to compress old expinfo directories.

Run it as "archive-expinfo [-t threshold]", where "threshold" is the
number of days experiments must have been inactive to be compressed
(defaulting to 1000).

Directories will be tarred and compressed in place.  For example, if
/usr/testbed/expinfo/testbed/example/1234 has been inactive for longer
than the threshold, its entire contents will be archived in
/usr/testbed/expinfo/testbed/example/1234.tar.bz2 and the original
directory removed.

The compression is extremely efficient, typically reducing directories
to around 2% of their original size.
parent ace8ba31
......@@ -25,7 +25,8 @@ SBIN_SCRIPTS = vlandiff vlansync withadminprivs export_tables \
spewconlog opsdb_control newnode suchown archive_list \
wanodecheckin wanodecreate spewimage \
anonsendmail epmodeset fixexpinfo node_traffic \
dumpdescriptor subboss_tftpboot_sync testbed-control
dumpdescriptor subboss_tftpboot_sync testbed-control \
WEB_SBIN_SCRIPTS= webnewnode webdeletenode webspewconlog webarchive_list \
webwanodecheckin webspewimage
if [ "$1" = "-t" ] && [ $# -eq 2 ] && [ "$2" -gt 0 ]; then
elif [ $# -ne 0 ]; then
cat >&2 <<-EOF
$0 [-t threshold]
exit 1
find @prefix@/expinfo -depth 4 -name activity.log -mtime +"$THRESHOLD" \
-print | sed 's/.activity.log$//' | \
( while read DIRNAME; do
echo -n "Compressing $DIRNAME... "
tar cy -C "$DIRNAME/.." -f "${DIRNAME}.tar.bz2" \
`basename "$DIRNAME"` && \
chown `stat -f %u "$DIRNAME"` "${DIRNAME}.tar.bz2" && \
rm -rf "$DIRNAME"
echo done
done )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment