summaryrefslogtreecommitdiffstats
path: root/admin/Interface/RestaurarImagen
diff options
context:
space:
mode:
authoradv <adv@uma.es>2011-10-19 16:17:26 +0000
committeradv <adv@uma.es>2011-10-19 16:17:26 +0000
commitf3117874002af6b5d4a53fdaab14baebc0c1e58d (patch)
tree51c066edf289229aa9e7167aab128a8987d1e18d /admin/Interface/RestaurarImagen
parent3f73876dbf767793a869e7a4f1f2538342b690b5 (diff)
version 1.0.2 httpd-log #421 #422
git-svn-id: https://opengnsys.es/svn/branches/version1.0@2354 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/Interface/RestaurarImagen')
-rwxr-xr-xadmin/Interface/RestaurarImagen75
1 files changed, 51 insertions, 24 deletions
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