From f3117874002af6b5d4a53fdaab14baebc0c1e58d Mon Sep 17 00:00:00 2001 From: adv Date: Wed, 19 Oct 2011 16:17:26 +0000 Subject: version 1.0.2 httpd-log #421 #422 git-svn-id: https://opengnsys.es/svn/branches/version1.0@2354 a21b9725-9963-47de-94b9-378ad31fedc9 --- admin/Interface/RestaurarImagen | 75 ++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 24 deletions(-) (limited to 'admin/Interface/RestaurarImagen') diff --git a/admin/Interface/RestaurarImagen b/admin/Interface/RestaurarImagen index 4941c69c..5974bf17 100755 --- a/admin/Interface/RestaurarImagen +++ b/admin/Interface/RestaurarImagen @@ -27,15 +27,32 @@ #@version 1.0.1 - Separación en protocolos de transferencia y postconfiguracion #@author Antonio J. Doblas Viso. Universidad de Málaga #@date 2011-05-11 -# +#@version 1.0.1 - Separación de los ficheros-log para ser gestionado por el httpd-log +#@author Antonio J. Doblas Viso. Universidad de Málaga +#@date 2011-05-11 + + +TIME1=$SECONDS + +OGLOGSESSION="${OGLOGSESSION=:-/tmp/session.log}" +OGLOGCOMMAND="${OGLOGCOMMAND=:-/tmp/command.log}" +OGLOGSESSION="/tmp/session.log" +OGLOGCOMMAND="/tmp/command.log" +echo " " > $OGLOGSESSION +echo " " > $OGLOGCOMMAND +echo " " > ${OGLOGCOMMAND}.tmp # Registro de ejecución -echo $* >> $OGLOGFILE +echo $* >> $OGLOGSESSION +echo "$*" &>> $OGLOGSESSION | $(tail -n 1 $OGLOGSESSION >> $OGLOGFILE) + + +echo "[1] Iniciando $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE # Si el origen(pariticion) esta bloqueada salir. -echo "TODO comprobando si esta bloqueado el $1 $2" &>> $OGLOGFILE +echo "TODO comprobando si esta bloqueado el $1 $2" | tee -a $OGLOGSESSION $OGLOGFILE #if ogIsLocked $1 $2; then # ogRaiseError $OG_ERR_LOCKED "$MSG_PARTITION, $1 $2" # exit $? @@ -50,8 +67,8 @@ REPO=${4:-"REPO"} if [ "$REPO" == "CACHE" ] then - echo "Iniciando un ogRestoreImage CACHE /$3 $1 $2" &>> $OGLOGFILE - ogRestoreImage CACHE "$3" "$1" "$2" &>> $OGLOGFILE + echo "[2] Iniciando un ogRestoreImage CACHE $3 $1 $2" | tee -a $OGLOGSESSION $OGLOGFILE + ogRestoreImage CACHE "$3" "$1" "$2" &>> $OGLOGCOMMAND RETVAL=$? fi @@ -59,39 +76,49 @@ fi if [ "$REPO" == "REPO" ] then - echo "updateCache REPO \"$3.img\" $5 $6" &>> $OGLOGFILE - updateCache REPO "$3.img" "$5" "$6" &>> $OGLOGFILE + echo "[2] updateCache REPO \"$3.img\" $5 $6" | tee -a $OGLOGSESSION $OGLOGFILE + TIME2=$SECONDS + updateCache REPO "$3.img" "$5" "$6" &>> $OGLOGCOMMAND RETVAL=$? + TIME2=$[SECONDS-TIME2] + echo " [ ] Duracion del subproceso updateCache $[TIME2/60]m $[TIME2%60]s" | tee -a $OGLOGSESSION $OGLOGFILE case $RETVAL in - 0) - echo "updateCache (correcto); re realiza ogRestoreImage REPO /$3 $1 $2 UNICAST" &>> $OGLOGFILE - ogRestoreImage CACHE "$3" "$1" "$2" &>> $OGLOGFILE - RETVAL=$? + 0) + echo "[50] updateCache (correcto)" | tee -a $OGLOGSESSION $OGLOGFILE + echo "[55] Restaurando la imagen desde la cache con comando: ogRestoreImage CACHE $3 $1 $2 UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE + TIME3=$SECONDS + ogRestoreImage CACHE "$3" "$1" "$2" &> $OGLOGCOMMAND + RETVAL=$? + TIME3=$[SECONDS-TIME3] + echo " [ ] Duracion del subproceso ogRestoreImage CACHE $[TIME3/60]m $[TIME3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE ;; 15) - echo "updateCache(no hay CACHE); se realiza ogRestoreImage REPO /$3 $1 $2 UNICAST" &>> $OGLOGFILE - ogRestoreImage REPO "$3" "$1" "$2" &>> $OGLOGFILE - RETVAL=$? + echo "[50] updateCache(no hay CACHE); se realiza ogRestoreImage REPO $3 $1 $2 UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE + echo "[55] Se restaura la imagen directamente desde el REPO: ogRestoreImage REPO $3 $1 $2 UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE + TIME3=$SECONDS + ogRestoreImage REPO "$3" "$1" "$2" &> $OGLOGCOMMAND + RETVAL=$? ;; 16) - echo "updateCache(no hay espacio sufiente en la CACHE), Se realiza ogRestoreImage REPO /$3 $1 $2 UNICAST" &>> $OGLOGFILE - ogRestoreImage REPO "$3" "$1" "$2" &>> $OGLOGFILE + echo "[50] updateCache(no hay espacio sufiente en la CACHE), Se realiza ogRestoreImage REPO $3 $1 $2 UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE + TIME3=$SECONDS + ogRestoreImage REPO "$3" "$1" "$2" &> $OGLOGCOMMAND RETVAL=$? + TIME3=$[SECONDS-TIME3] + echo " [ ] Duracion del subproceso ogRestoreImage REPO $[TIME3/60]m $[TIME3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE ;; esac fi if [ $RETVAL == 0 ] then - echo "Iniciando la Configuracion del Sistema Restaurado" &>> $OGLOGFILE + echo "[90] Iniciando la Configuracion del Sistema Restaurado" | tee -a $OGLOGSESSION $OGLOGFILE configureOs "$1" "$2" fi -if [ $RETVAL == 0 ] -then - rm $OGLOGFILE - touch $OGLOGFILE -else - echo $RETVAL &>> $OGLOGFILE -fi + +TIME=$[SECONDS-TIME1] +echo "[100] Duracion de la operacion $[TIME/60]m $[TIME%60]s" | tee -a $OGLOGSESSION $OGLOGFILE + + exit $RETVAL -- cgit v1.2.3-18-g5258