Creation/suppression auto et systematique du repertoire SH_TMPDIR
This commit is contained in:
parent
f148fb7aa7
commit
dce2d591ee
@ -28,6 +28,7 @@
|
||||
# la fonction logname ne renvoi rien ?
|
||||
# 2.1.2 29-06-2017 - Emmanuel Confrere - Ano : Erreur : logname() renvoi null si connexion via sshd
|
||||
# Remplacement de logname() par /etc/proc/self/loginuid
|
||||
# 2.2.0 19-02-2018 - Doug Le Tough - Evo : Definition de ${SH_TMP_DIR} constitue de ${NC_EXPL_TMP}/${SH_SESSION_ID}
|
||||
## -----------------------------------------------------------------------------
|
||||
## Ce fichier contient les varaibles de fonctionement commune au script du socle
|
||||
## Il est charge systematiquement au debut de chaque script
|
||||
@ -109,9 +110,12 @@ SH_CPT_SEMAPHORE=1 # Valeur d execution du
|
||||
# - Connection a la base de referencement
|
||||
[ -z "${SH_CNX_REF}" ] && SH_CNX_REF=${SH_CNX_REF:="cmdb/IRji_5#1O@refpro"}
|
||||
|
||||
# - Definition du repertoire temporaire ${SH_TMPDIR}
|
||||
SH_TMP_DIR="${NC_EXPL_TMP}/${SH_SESSION_ID}"
|
||||
|
||||
# Globalisation des variables
|
||||
export SH_FICLOG SH_FICCPT SH_CNX_REF SH_INDENT_MSG SH_SESSION_ID SH_NIV_DEBUG SH_SILENCE
|
||||
export SH_RETENTION_CPT SH_RETENTION_LOG SH_LOGUSER SH_EXECUSER
|
||||
export SH_RETENTION_CPT SH_RETENTION_LOG SH_LOGUSER SH_EXECUSER SH_TMP_DIR
|
||||
|
||||
# - Chargement de l'environement specifique au script
|
||||
if [ -f ${SH_FICCFG} ]
|
||||
|
@ -34,6 +34,7 @@
|
||||
# 1.2.1 10-03-2017 - Emmanuel Confrere - Ano : Suppression des variables NC_EXPL_*
|
||||
# 1.2.2 06-04-2017 - Emmanuel Confrere - Ano : Degradation de performance serveur (Cf. DBA-2458)
|
||||
# Suppression de la commande "find"
|
||||
# 1.3.0 19-02-2017 - Doug Le Tough - Evo : Suppression systematique du repertoire ${SH_TMP_DIR} en fin de script
|
||||
##----------------------------------------------------------------------------
|
||||
|
||||
function fct_erreur
|
||||
@ -98,6 +99,7 @@ case "${L_Cmd}" in
|
||||
if [ -n "${NC_EXPL_TMP}" -a -n "${SH_SESSION_ID}" -a "${NC_EXPL_TMP}" != "/" -a "${NC_EXPL_TMP}" != "." ]
|
||||
then
|
||||
rm -f "${NC_EXPL_TMP}/*${SH_SESSION_ID}*"
|
||||
rm -Rf ${SH_TMP_DIR}
|
||||
else
|
||||
fct_message -debug 0 "<lib:fct_erreur> Variable de session incoherente : NC_EXPL_TMP = ${NC_EXPL_TMP} & SH_SESSION_ID = ${SH_SESSION_ID}"
|
||||
fi
|
||||
|
@ -49,8 +49,19 @@
|
||||
# Les variables SH_ARGS et SH_ARG_<option> ou leur representant defini dans la declaration
|
||||
# des option et argument (@ARG: et @OPT:) peuvent etre surcharge dans le fichier de configuration.
|
||||
# 3.0.1 26-11-2017 - Doug Le Tough - Ano : La construction de L_PARMF ne permet pas de differencier les differentes execution d'un meme script
|
||||
# 3.1.0 19-02-2018 - Doug Le Tough - Evo : Creation automatique et systematique du repertoire temporaire ${SH_TMPDIR} consitue de ${NC_EXPL_TMP}/${SH_SESSION_ID}
|
||||
##----------------------------------------------------------------------------
|
||||
|
||||
function fct_mk_tmp_dir
|
||||
{
|
||||
mkdir -p ${NC_EXPL_TMP}/${SH_SESSION_ID}
|
||||
RET_VAL=$?
|
||||
if [ ! ${RET_VAL} -eq 0 ]; then
|
||||
fct_message "Erreur lors de la creation du repertoire temporaire" -color rouge
|
||||
fct_erreur 254
|
||||
fi
|
||||
}
|
||||
|
||||
function fct_params
|
||||
{
|
||||
local L_PROG=${SH_DIR}/${SH_PROG} # Nom absolu du script
|
||||
@ -584,6 +595,7 @@ then
|
||||
done
|
||||
fct_erreur 254
|
||||
fi
|
||||
fct_mk_tmp_dir
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user