source: trunk/libIGCM/AA_purge_simulation @ 1392

Last change on this file since 1392 was 1392, checked in by sdipsl, 7 years ago
  • Property svn:keywords set to Date Author Revision
File size: 4.1 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 perform lib test checks, stack construction and IO functions instrumentation
31#D- Default=true
32DEBUG_debug=true
33
34#D- Messaging : all activities and call stacks will be sent to ipsl servers
35#D- If true will imply DEBUG_debug=true
36#D- Default=false
37#D-
38BigBrother=true
39
40
41#D--------------------------------------------------------------------==
42
43echo "purge an entire simulation :"
44echo "Script used to purge a simulation from the IGCM_OUT directory !"
45echo "This script will completely wipe out your simulation and will erase all files !!!"
46echo "Be careful and read all informations !"
47echo "----"
48echo "It must be called in Experience directory (so-called SUBMIT_DIR)."
49echo "----"
50
51#D--------------------------------------------------------------------==
52
53. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
54. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
55. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
56#-------
57SUBMIT_DIR=$( pwd )
58. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
59. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
60#-------
61( ${DEBUG_debug} ) && IGCM_debug_Check
62( ${DEBUG_debug} ) && IGCM_card_Check
63( ${DEBUG_debug} ) && IGCM_date_Check
64
65if [ ! -f ${SUBMIT_DIR}/config.card ] ; then
66  echo "A config.card is needed to proceed"
67  exit
68fi
69
70#==================================
71# First of all
72#
73# Read libIGCM compatibility version in config.card
74# Read UserChoices section
75# Read Ensemble section
76# Read Post section
77# Define all netcdf output directories
78#==================================
79IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card
80
81# ------------------------------------------------------------------
82# Activate BigBrother so as to supervise this simulation
83# ------------------------------------------------------------------
84IGCM_debug_BigBro_Initialize
85
86# List whats need to be done
87echo "Search directories in ${R_SAVE}"
88set +A ListDirectories -- $( IGCM_sys_RshArchive "find ${R_SAVE} ${R_BUFR} ${R_FIGR} -type d | sort | uniq" )
89CountListDirectories=${#ListDirectories[@]}
90
91# And proceed
92if [ ${CountListDirectories} -gt 0 ] ; then
93  for dir in ${ListDirectories[@]} ; do
94    IGCM_debug_Print 2 -e "\033[1;31m ${dir}\033[m"
95  done
96  IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/run.card\033[m"
97  IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/Debug\033[m"
98  IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/Script_Output_*.??????\033[m"
99
100  echo -e "\033[1;32mDo you REALLY want to erase all those directories and files?"
101  echo -n -e " Your answer (y/n) : \033[m"
102  read reponse
103  case ${reponse} in
104
105  oui|OUI|o|y|yes|YES)
106    echo "OK. It will be erased."
107    for dir in ${ListDirectories[@]} ; do
108      IGCM_sys_RshArchive rm -rf ${dir}
109    done
110    # Remove dods hardlink
111    IGCM_sys_Dods_Rm
112    # Remove run.card
113    rm -f ${SUBMIT_DIR}/run.card
114    # Remove Script_Output
115    rm -f ${SUBMIT_DIR}/Script_Output_*.??????
116    # Remove the Debug directory
117    rm -rf ${SUBMIT_DIR}/Debug
118    # Send a message telling we want to purge
119    IGCM_debug_sendAMQP_Purge
120    echo "done."
121    ;;
122  non|NON|n|no|NO)
123    echo "Nothing to do !"
124    ;;
125  esac
126fi
127
128exit 0
Note: See TracBrowser for help on using the repository browser.