-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·65 lines (56 loc) · 1.67 KB
/
run.sh
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
61
62
63
64
65
#!/bin/sh
BASE=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
LOG=$BASE/log/sstInit.log
WEBDIR=/afs/cern.ch/user/c/cmssst/www/sreadiness/SiteReadiness/
LINK=http://cms-site-readiness.web.cern.ch/cms-site-readiness
CSS=css/
INPUT=input/
SSTMAIL="[email protected]"
echo "Checking Kerberos ticket/AFS token:"
/bin/rm ${LOG} 1>/dev/null 2>&1
/usr/bin/klist 2> ${LOG}
RC=$?
if [ ${RC} -ne 0 ]; then
MSG="no valid Kerberos ticket, klist=${RC}"
echo " ${MSG}"
if [ -t 0 ]; then
# attached terminal, prompt user to kinit for 25 hours
/usr/bin/kinit -l 25h [email protected]
if [ $? -ne 0 ]; then
exit ${RC}
fi
else
/usr/bin/Mail -s "$0 ${MSG}" ${SSTMAIL} < ${LOG}
exit ${RC}
fi
fi
/bin/rm ${LOG} 1>/dev/null 2>&1
/usr/bin/aklog 2> ${LOG}
RC=$?
if [ ${RC} -ne 0 ]; then
MSG="unable to acquire AFS token, aklog=${RC}"
echo " ${MSG}"
/usr/bin/Mail -s "$0 ${MSG}" ${SSTMAIL} < ${LOG}
exit ${RC}
fi
# now, you can generate the report
cd $BASE
# create directory if not exists
if [ ! -d $WEBDIR/HTML/ ]; then
mkdir -p $WEBDIR/HTML/
fi
# copy css files
cp $CSS/* $WEBDIR/HTML/
# delete SR reports older than 1 year
echo "Deleting Site Readiness reports older than 1 year"
find $WEBDIR/HTML/SiteReadinessReport* -mtime +365 -exec rm {} +
# Active links
echo "*** EnabledLinksFromPhEDExDataSrv.py ***"
python EnabledLinksFromPhEDExDataSrv.py -p $WEBDIR -u $LINK
# Site Readiness python
echo "*** SiteReadiness.py ***"
./SiteReadiness.py -p $WEBDIR -u $LINK -i $INPUT
# $link: address to use inside files for output links
# Usable sites for analysis
echo "*** UsableSites.py ***"
python UsableSites.py -p $WEBDIR -u $LINK