source: trunk/libIGCM/AA_purge_simulation @ 1378

Last change on this file since 1378 was 1378, checked in by sdipsl, 7 years ago
  • notify Hermes so that simulation will be erased from the database
  • Property svn:keywords set to Date Author Revision
File size: 4.0 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
65#==================================
66# First of all
67#
68# Read libIGCM compatibility version in config.card
69# Read UserChoices section
70# Read Ensemble section
71# Read Post section
72# Define all netcdf output directories
73#==================================
74IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card
75
76# ------------------------------------------------------------------
77# Activate BigBrother so as to supervise this simulation
78# ------------------------------------------------------------------
79IGCM_debug_BigBro_Initialize
80
81# List whats need to be done
82echo "Search directories in ${R_SAVE}"
83set +A ListDirectories -- $( IGCM_sys_RshArchive "find ${R_SAVE} ${R_BUFR} ${R_FIGR} -type d | sort | uniq" )
84CountListDirectories=${#ListDirectories[@]}
85
86# And proceed
87if [ ${CountListDirectories} -gt 0 ] ; then
88  for dir in ${ListDirectories[@]} ; do
89    IGCM_debug_Print 2 -e "\033[1;31m ${dir}\033[m"
90  done
91  IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/run.card\033[m"
92  IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/Debug\033[m"
93  IGCM_debug_Print 2 -e "\033[1;31m ${SUBMIT_DIR}/Script_Output_*.??????\033[m"
94
95  echo -e "\033[1;32mDo you REALLY want to erase all those directories and files?"
96  echo -n -e " Your answer (y/n) : \033[m"
97  read reponse
98  case ${reponse} in
99
100  oui|OUI|o|y|yes|YES)
101    echo "OK. It will be erased."
102    for dir in ${ListDirectories[@]} ; do
103      IGCM_sys_RshArchive rm -rf ${dir}
104    done
105    # Remove dods hardlink
106    IGCM_sys_Dods_Rm
107    # Remove run.card
108    rm -f ${SUBMIT_DIR}/run.card
109    # Remove Script_Output
110    rm -f ${SUBMIT_DIR}/Script_Output_*.??????
111    # Remove the Debug directory
112    rm -rf ${SUBMIT_DIR}/Debug
113    # Send a message telling we want to purge
114    IGCM_debug_sendAMQP_Purge
115    echo "done."
116    ;;
117  non|NON|n|no|NO)
118    echo "Nothing to do !"
119    ;;
120  esac
121fi
122
123exit 0
Note: See TracBrowser for help on using the repository browser.