source: trunk/libIGCM/AA_purge_simulation @ 1366

Last change on this file since 1366 was 1363, checked in by sdipsl, 8 years ago

Bug fix.

  • Property svn:keywords set to Date Author Revision
File size: 3.4 KB
Line 
1#!/bin/ksh
2#**************************************************************
3# Author: Sebastien Denvil
4# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
5# $Revision::                                          $ Revision of last commit
6# $Author::                                            $ Author of last commit
7# $Date::                                              $ Date of last commit
8# IPSL (2006)
9#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
10#
11#**************************************************************
12# ID of your genci project. Curie only : post-processing jobs need it to run properly
13#-Q- curie export BRIDGE_MSUB_PROJECT=::default_project::
14
15#set -eu
16#set -vx
17
18libIGCM=::modipsl::/libIGCM
19
20#D- Task type DO NOT CHANGE (computing, post-processing or checking)
21TaskType=checking
22
23#D--------------------------------------------------------------------==
24#D-                   -1. User modification place
25#D--------------------------------------------------------------------==
26
27#D- Increased verbosity (1, 2, 3)
28Verbosity=3
29
30#D- Low level debug : to bypass lib test checks and stack construction
31#D- Default=true
32DEBUG_debug=false
33
34#D--------------------------------------------------------------------==
35
36echo "purge an entire simulation :"
37echo "Script used to purge a simulation from the IGCM_OUT directory !"
38echo "This script will completely wipe out your simulation and will erase all files !!!"
39echo "Be careful and read all informations !"
40echo "----"
41echo "It must be called in Experience directory (so-called SUBMIT_DIR)."
42echo "----"
43
44#D--------------------------------------------------------------------==
45
46. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
47. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
48. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
49#-------
50SUBMIT_DIR=$( pwd )
51. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
52. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
53#-------
54( ${DEBUG_debug} ) && IGCM_debug_Check
55( ${DEBUG_debug} ) && IGCM_card_Check
56( ${DEBUG_debug} ) && IGCM_date_Check
57
58#==================================
59# First of all
60#
61# Read libIGCM compatibility version in config.card
62# Read UserChoices section
63# Read Ensemble section
64# Read Post section
65# Define all netcdf output directories
66#==================================
67IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card
68
69# ------------------------------------------------------------------
70# Activate BigBrother so as to supervise this simulation
71# ------------------------------------------------------------------
72IGCM_debug_BigBro_Initialize
73
74# List whats need to be done
75echo "Search directories in ${R_SAVE}"
76set +A ListDirectories -- $( IGCM_sys_RshArchive "find ${R_SAVE} ${R_BUFR} ${R_FIGR} -type d | sort | uniq" )
77CountListDirectories=${#ListDirectories[@]}
78
79# And proceed
80if [ ${CountListDirectories} -gt 0 ] ; then
81  for dir in ${ListDirectories[@]} ; do
82    IGCM_debug_Print 2 -e "\033[1;31m ${dir}\033[m"
83  done
84
85  echo -e "\033[1;32mDo you REALLY want to erase all those directories ?"
86  echo -n -e " Your answer (y/n) : \033[m"
87  read reponse
88  case ${reponse} in
89
90  oui|OUI|o|y|yes|YES)
91    echo "OK. It will be erased."
92    for dir in ${ListDirectories[@]} ; do
93      IGCM_sys_RshArchive rm -rf ${dir}
94    done
95    # Remove dods hardlink
96    IGCM_sys_Dods_Rm
97    # Send a message telling we want to purge
98    IGCM_debug_sendAMQP_Purge
99    echo "done."
100    ;;
101  non|NON|n|no|NO)
102    echo "Nothing to do !"
103    ;;
104  esac
105fi
106
107exit 0
Note: See TracBrowser for help on using the repository browser.