forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcWrap.sh
executable file
·44 lines (34 loc) · 1.34 KB
/
cWrap.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
cd /afs/cern.ch/user/c/cmst2/Unified/WmAgentScripts
oweek=`date +%W`
week=${oweek#0}
let oddity=week%2
if ( [ "$USER" = "vlimant" ] && [ "$oddity" = "0" ] ) || ( [ "$USER" = "mcremone" ] && [ "$oddity" = "1" ] ) ; then
echo no go for $USER on week $week
exit
fi
modulename=`echo $1 | sed 's/\.py//' | sed 's/Unified\///'`
log=/afs/cern.ch/user/c/cmst2/www/unified/logs/$modulename/`date +%F_%T`.log
echo `date` > $log
echo $USER >> $log
echo the week $week oddity is $oddity >> $log
echo module $modulename>> $log
export X509_USER_PROXY=$HOME/private/personal/voms_proxy.cert
source /data/srv/wmagent/current/apps/wmagent/etc/profile.d/init.sh
echo >> $log
start=`date +%s`
echo $modulename:`date` >> /afs/cern.ch/user/c/cmst2/www/unified/logs/running
echo $modulename:`date` > /afs/cern.ch/user/c/cmst2/www/unified/logs/last_running
python $* &>> $log
if [ $? == 0 ]; then
echo "finished" >> $log
else
echo "abnormal termination" >> $log
mail -s "[Ops] module "$modulename" failed" -a $log vlimant@cern.ch,matteoc@fnal.gov
fi
stop=`date +%s`
let stop=stop-start
echo $modulename:$start:$stop > /afs/cern.ch/user/c/cmst2/www/unified/logs/$modulename/`date +%s`.time
echo `date` >> $log
## copy log to lasts
cp $log /afs/cern.ch/user/c/cmst2/www/unified/logs/$modulename/last.log
cp $log /afs/cern.ch/user/c/cmst2/www/unified/logs/last.log