1 | #!/bin/bash |
---|
2 | # |
---|
3 | # Cron to keep track of the consumption and data volume |
---|
4 | # for GENCMIP6 project. |
---|
5 | # To be executed every day at 6am |
---|
6 | # ====================================================================== |
---|
7 | |
---|
8 | # Initialize module command |
---|
9 | # ========================= |
---|
10 | if [ -f /etc/bashrc ] ; then |
---|
11 | . /etc/bashrc |
---|
12 | fi |
---|
13 | # Load python |
---|
14 | # =========== |
---|
15 | #Â python/2.7.3 is the default, but it comes with matplotlib 1.2, |
---|
16 | # which is too old (no context manager for PdfPages) |
---|
17 | module load python/2.7.8 |
---|
18 | |
---|
19 | # Go to root directory |
---|
20 | # ==================== |
---|
21 | cd ${HOME}/ConsoGENCMIP6/ |
---|
22 | |
---|
23 | # Main script to get data |
---|
24 | # ======================= |
---|
25 | script="conso_gencmip6" |
---|
26 | printf "${script}\n" |
---|
27 | echo "--------------------" |
---|
28 | bin/${script}.py -v |
---|
29 | rc=$? |
---|
30 | if [ ${rc} -ne 0 ] ; then |
---|
31 | echo "${script} terminated abnormally" |
---|
32 | exit |
---|
33 | else |
---|
34 | echo "${script} OK" |
---|
35 | fi |
---|
36 | |
---|
37 | # Plot daily consumption |
---|
38 | # ====================== |
---|
39 | # -f : plot the whole period of the project |
---|
40 | # -d : copy plot on dods |
---|
41 | script="plot_bilan" |
---|
42 | printf "\n${script}\n" |
---|
43 | echo "--------------------" |
---|
44 | bin/${script}.py -fv |
---|
45 | rc=$? |
---|
46 | if [ ${rc} -ne 0 ] ; then |
---|
47 | echo "${script} terminated abnormally" |
---|
48 | else |
---|
49 | echo "${script} OK" |
---|
50 | fi |
---|
51 | |
---|
52 | script="plot_bilan_jobs" |
---|
53 | printf "\n${script}\n" |
---|
54 | echo "--------------------" |
---|
55 | bin/${script}.py -fd |
---|
56 | rc=$? |
---|
57 | if [ ${rc} -ne 0 ] ; then |
---|
58 | echo "${script} terminated abnormally" |
---|
59 | else |
---|
60 | echo "${script} OK" |
---|
61 | fi |
---|
62 | |
---|
63 | script="plot_login" |
---|
64 | printf "\n${script}\n" |
---|
65 | echo "--------------------" |
---|
66 | bin/${script}.py -v |
---|
67 | rc=$? |
---|
68 | if [ ${rc} -ne 0 ] ; then |
---|
69 | echo "${script} terminated abnormally" |
---|
70 | else |
---|
71 | echo "${script} OK" |
---|
72 | fi |
---|
73 | |
---|
74 | script="plot_store" |
---|
75 | printf "\n${script}\n" |
---|
76 | echo "--------------------" |
---|
77 | bin/${script}.py -v |
---|
78 | rc=$? |
---|
79 | if [ ${rc} -ne 0 ] ; then |
---|
80 | echo "${script} terminated abnormally" |
---|
81 | else |
---|
82 | echo "${script} OK" |
---|
83 | fi |
---|
84 | |
---|
85 | printf "\nEnd of script OK\n" |
---|
86 | |
---|