summaryrefslogtreecommitdiffstats
path: root/admin/Interface
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
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')
-rwxr-xr-xadmin/Interface/CrearImagen15
-rwxr-xr-xadmin/Interface/EjecutarScript32
-rwxr-xr-xadmin/Interface/RestaurarImagen75
3 files changed, 87 insertions, 35 deletions
diff --git a/admin/Interface/CrearImagen b/admin/Interface/CrearImagen
index abc6edea..1d59da29 100755
--- a/admin/Interface/CrearImagen
+++ b/admin/Interface/CrearImagen
@@ -28,11 +28,24 @@
#Códigos de error de la funcion ogCreateImage
+TIME1=$SECONDS
+#TODO: revisar las variables.
+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 | $(tail -n 1 $OGLOGSESSION >> $OGLOGFILE)
+
+
# Solo ejecutable por OpenGnSys Client.
PATH=$PATH:$(dirname $0)
PROG=$(basename $0)
@@ -69,7 +82,7 @@ fi
if [ -f createImage$ogengine ]; then
createImage$ogengine "$1" "$2" "$REPO" /"$3" &>> $OGLOGFILE
else
- createImage "$1" "$2" "$REPO" /"$3" &>> $OGLOGFILE
+ createImage "$1" "$2" "$REPO" /"$3" &>> $OGLOGCOMMAND
fi
RETVAL=$?
diff --git a/admin/Interface/EjecutarScript b/admin/Interface/EjecutarScript
index 3de64815..431164b9 100755
--- a/admin/Interface/EjecutarScript
+++ b/admin/Interface/EjecutarScript
@@ -1,21 +1,33 @@
#!/bin/bash
+TIME1=$SECONDS
-echo -e >> $OGLOGFILE
-echo "Contenido de la ejecucion: *****************************" >> $OGLOGFILE
+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
+
+
+echo "START JOBS ***************************** " | tee -a $OGLOGSESSION $OGLOGFILE
+
+echo "Instrucciones a ejecutar: *****************************" >> $OGLOGFILE
cat $1 >> $OGLOGFILE
-echo -e >> $OGLOGFILE
-echo -e >> $OGLOGFILE
-echo "Salida: *****************************" >> $OGLOGFILE
+
+echo "Salida de las instrucciones: *****************************" >> $OGLOGFILE
chmod +x $1
-$1 &>> $OGLOGFILE
+$1 &>> $OGLOGCOMMAND
RETVAL=$?
echo $RETVAL &>> $OGLOGFILE
-
+TIME=$[SECONDS-TIME1]
if [ $RETVAL == 0 ]
then
- rm $OGLOGFILE
- touch $OGLOGFILE
+ echo "[100] Duracion de la operacion $[TIME/60]m $[TIME%60]s" | tee -a $OGLOGSESSION $OGLOGFILE
else
- echo $RETVAL &>> $OGLOGFILE
+ echo "ERROR no operacion no realizada" | tee -a $OGLOGSESSION $OGLOGFILE
fi
+echo "END JOBS ***************************** " | tee -a $OGLOGSESSION $OGLOGFILE
exit $RETVAL \ No newline at end of file
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