source: TOOLS/ConsoGENCMIP6/launch_conso.sh @ 2524

Last change on this file since 2524 was 2524, checked in by labetoulle, 6 years ago

plot_store.py : plot initial volume in addition to current volume.

  • Property svn:executable set to *
File size: 2.3 KB
Line 
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# =========================
10if [ -f /etc/bashrc ] ; then
11  . /etc/bashrc
12fi
13
14# Load python
15# ===========
16# python/2.7.3 is the default, but it comes with matplotlib 1.2,
17# which is too old (no context manager for PdfPages)
18module load python/2.7.8
19
20# Go to root directory
21# ====================
22ROOT_DIR=$( dirname $0 )
23cd ${ROOT_DIR}
24
25# Main script to get data
26# =======================
27script="conso_gencmip6"
28printf "${script}\n"
29echo "--------------------"
30bin/${script}.py -v
31rc=$?
32if [ ${rc} -ne 0 ] ; then
33  echo "${script} terminated abnormally"
34  exit
35else
36  echo "${script} OK"
37fi
38
39# Plot daily consumption
40# ======================
41# -f : plot the whole period of the project
42# -d : copy plot on dods
43# -v : verbose mode
44script="plot_bilan"
45printf "\n${script}\n"
46echo "--------------------"
47bin/${script}.py -fv
48rc=$?
49if [ ${rc} -ne 0 ] ; then
50  echo "${script} terminated abnormally"
51else
52  echo "${script} OK"
53fi
54
55script="plot_bilan_jobs"
56printf "\n${script}\n"
57echo "--------------------"
58bin/${script}.py -fv
59rc=$?
60if [ ${rc} -ne 0 ] ; then
61  echo "${script} terminated abnormally"
62else
63  echo "${script} OK"
64fi
65
66script="plot_login"
67printf "\n${script}\n"
68echo "--------------------"
69bin/${script}.py -v
70rc=$?
71if [ ${rc} -ne 0 ] ; then
72  echo "${script} terminated abnormally"
73else
74  echo "${script} OK"
75fi
76
77script="plot_store"
78printf "\n${script}\n"
79echo "--------------------"
80# Last STORE file produced
81data_file="OUT_CONSO_STORE"
82OUTDIR="${HOME}/ConsoGENCMIP6/output"
83# Directories in last file
84dirlist=$( gawk '{if ($4 != "dirname") print $4}' ${OUTDIR}/${data_file} )
85# Where to find the saved files
86SAVEDIR="${WORKDIR}/ConsoGENCMIP6/data"
87# Previous STORE files
88filelist=$( ls ${SAVEDIR}/${data_file}_* )
89fileout="${data_file}_INIT"
90echo "date       login      dirsize dirname" > ${OUTDIR}/${fileout}
91for dir in ${dirlist} ; do
92  grep -h "$dir\$" ${filelist} | head -1
93  grep -h "$dir\$" ${filelist} | head -1 >> ${OUTDIR}/${fileout}
94done
95
96bin/${script}.py -v
97rc=$?
98if [ ${rc} -ne 0 ] ; then
99  echo "${script} terminated abnormally"
100else
101  echo "${script} OK"
102fi
103
104printf "\nEnd of script OK\n"
105
Note: See TracBrowser for help on using the repository browser.