-
Notifications
You must be signed in to change notification settings - Fork 2
/
orville_daily.cron
executable file
·60 lines (50 loc) · 2.28 KB
/
orville_daily.cron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Where the data are stored
ORVILLE_DATA_DIR=/data/orville
# Where the software is stored
ORVILLE_SOFTWARE_DIR=/home/jdowell/orville3
# Delete (u,v) radial and spectra plots more than three weeks old
find ${ORVILLE_DATA_DIR}/baselines -mtime +22 -exec rm -r {} \;
find ${ORVILLE_DATA_DIR}/spectra -mtime +22 -exec rm -r {} \;
# Delete correlation matrix data more than three months old
find ${ORVILLE_DATA_DIR}/matrices -mtime +91 -exec rm -r {} \;
# Delete old logs more than 6 months old
find ${ORVILLE_DATA_DIR}/log -mtime +181 -exec rm {} \;
# Build movies of the LWATV images from previous days
for mjd in `find ${ORVILLE_DATA_DIR}/lwatv -type d -name 6\* | sort | head -n -1 `; do
${ORVILLE_SOFTWARE_DIR}/make_movies.py -o ${ORVILLE_DATA_DIR}/movies ${mjd}
if [[ "$?" == "0" ]]; then
rm -rf ${mjd}
fi
done
# Upload the movies
rsync -e ssh -avHL ${ORVILLE_DATA_DIR}/movies/*[0-9][0-9].mov ${ORVILLE_DATA_DIR}/movies/movielist.js \
mcsdr@lwalab.phys.unm.edu:/var/www/lwatv2/
# Backup the archive
rsync -e ssh -avH ${ORVILLE_DATA_DIR}/archive/6* \
pasi@lda10g.alliance.unm.edu:/FileStore/Orville/
# Delete events as needed to keep us below 25 TB
rawsize=`du -b ${ORVILLE_DATA_DIR}/images | tail -n1 | awk '{print $1}'`
while [[ "${rawsize}" -ge $((25*1024*1024*1024*1024)) ]]; do
oldest=`ls -td ${ORVILLE_DATA_DIR}/images/6* | tail -n1`
echo "Removing ${oldest}"
rm -rf ${oldest}
rawsize=`du -b ${ORVILLE_DATA_DIR}/images | tail -n1 | awk '{print $1}'`
done
# Report on disk usage
echo "Orville Disk Usage:"
usage=`du -hs ${ORVILLE_DATA_DIR}/baselines | tail -n1 | awk '{print $1}'`
echo " (u,v) radial plots: ${usage}"
usage=`du -hs ${ORVILLE_DATA_DIR}/spectra | tail -n1 | awk '{print $1}'`
echo " spectra plots: ${usage}"
usage=`du -hs ${ORVILLE_DATA_DIR}/matrices | tail -n1 | awk '{print $1}'`
echo " correlation matrices: ${usage}"
usage=`du -hs ${ORVILLE_DATA_DIR}/lwatv | tail -n1 | awk '{print $1}'`
echo " LWATV images: ${usage}"
usage=`du -hs ${ORVILLE_DATA_DIR}/movies | tail -n1 | awk '{print $1}'`
echo " LWATV movies: ${usage}"
usage=`du -hs ${ORVILLE_DATA_DIR}/images | tail -n1 | awk '{print $1}'`
echo " Raw images: ${usage}"
usage=`du -hs ${ORVILLE_DATA_DIR} | tail -n1 | awk '{print $1}'`
echo "==="
echo " Total disk usage: ${usage}"