diff options
author | ramon <ramongomez@us.es> | 2013-12-13 13:22:26 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2013-12-13 13:22:26 +0000 |
commit | f9e03adb9ed848602ff805dd0d9dfc2a27ff59ec (patch) | |
tree | 87dfbf5321a4331d5a0bb9e9ca5d896ad4d5ba4f /client/shared | |
parent | d473bb925da6a79bc19b0fa545a5dbf8f878ab9e (diff) |
#537 #565: Solución problema al obtener salida de error de comando redirigido a tubería.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4108 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/shared')
-rwxr-xr-x | client/shared/scripts/deployImage | 4 | ||||
-rwxr-xr-x | client/shared/scripts/restoreBaseImage | 3 | ||||
-rwxr-xr-x | client/shared/scripts/restoreImage | 8 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/client/shared/scripts/deployImage b/client/shared/scripts/deployImage index db6b70b7..9837f90d 100755 --- a/client/shared/scripts/deployImage +++ b/client/shared/scripts/deployImage @@ -146,7 +146,7 @@ case "$NEXTOPERATION" in CACHE) echo "[55] $MSG_HELP_ogRestoreImage : restoreImage CACHE $IMGNAME $DISK $PART UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE restoreImage CACHE "$IMGNAME" "$DISK" "$PART" | tee -a $OGLOGCOMMAND - RETVAL=$? + RETVAL=${PIPESTATUS[0]} RESUMERESTOREIMAGE=$(grep "Total Time:" $OGLOGCOMMAND) ;; UNICAST) @@ -158,7 +158,7 @@ case "$NEXTOPERATION" in MULTICAST) echo "[55] $MSG_HELP_ogRestoreImage : restoreImage REPO $IMGNAME $DISK $PART $PROTO $PROTOOPT" | tee -a $OGLOGSESSION $OGLOGFILE restoreImage REPO "$IMGNAME" "$DISK" "$PART" $PROTO $PROTOOPT - RETVAL=$? + RETVAL=$? RESUMERESTOREIMAGE=$(grep "Total Time:" $OGLOGCOMMAND) ;; esac diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage index 37a7d504..61e13a6e 100755 --- a/client/shared/scripts/restoreBaseImage +++ b/client/shared/scripts/restoreBaseImage @@ -89,9 +89,8 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then # Sincronizamos si existe el fichero y si no usamos updateCache. echo "[10] $MSG_SCRIPTS_TASK_START updateCache REPO $2.$IMGEXT $PROTO $6" | tee -a $OGLOGFILE $OGLOGSESSION echo " updateCache REPO" "/$2.$IMGEXT" "$PROTO" "$6" | tee -a $OGLOGFILE $OGLOGSESSION - #updateCache REPO "/$2.$IMGEXT" "$PROTO" "$6" &>> $OGLOGCOMMAND updateCache REPO "/$2.$IMGEXT" "$PROTO" "$6" 2>&1 | tee -a $OGLOGCOMMAND - RETVAL=$? + RETVAL=${PIPESTATUS[0]} if [ "$RETVAL" != "0" ] then echo "[39] $MSG_SCRIPTS_TASK_END updateCache REPO $2.$IMGEXT $5 $6 con error $RETVAL" | tee -a $OGLOGFILE $OGLOGSESSION diff --git a/client/shared/scripts/restoreImage b/client/shared/scripts/restoreImage index 6e85293a..f9af4f62 100755 --- a/client/shared/scripts/restoreImage +++ b/client/shared/scripts/restoreImage @@ -38,7 +38,8 @@ case "$PROTO" in UNICAST|UNICAST-DIRECT) # Restaurar la imagen. echo "[40] ogRestoreImage $REPO $IMGNAME $DISK $PART UNICAST" - ogRestoreImage "$REPO" "$IMGNAME" "$DISK" "$PART" UNICAST | tee -a $OGLOGCOMMAND || exit $? + ogRestoreImage "$REPO" "$IMGNAME" "$DISK" "$PART" UNICAST | tee -a $OGLOGCOMMAND + RETVAL=${PIPESTATUS[0]} ;; MULTICAST|MULTICAST-DIRECT) PORT=$(echo $PROTOOPT | cut -f1 -d":") @@ -47,7 +48,7 @@ case "$PROTO" in #TODO comprobar parametros anteriores ogMcastRequest "$IMGNAME.img" "$PROTOOPT" ogMcastReceiverPartition "$DISK" "$PART" "$PORT" "$TOOL" "$COMPRESS" | tee -a $OGLOGCOMMAND - RETVAL=$? + RETVAL=${PIPESTATUS[0]} ;; *) # Protocolo desconocido. ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG REPO|CACHE imagen ndisco nparticion [ UNICAST|MULTICAST opciones ]" @@ -57,3 +58,6 @@ esac TIME=$[SECONDS-TIME1] echo "[100] Duracion de la operacion $[TIME/60]m $[TIME%60]s" +# Código de salida del comando prinicpal de restauración. +exit $RETVAL + diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index b531da73..01c5896c 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -229,7 +229,7 @@ case "$PROTOCOLO" in echo -e "\n rsync -aHAX OPTRSYNC --quiet $USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/ $DIRLOCAL |tee -a $OGLOGSESSION $OGLOGFILE" rsync -aHAX$OPTRSYNC --quiet $USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/ $DIRLOCAL |tee -a $OGLOGSESSION $OGLOGFILE # RETVAL="1" -> OK RETVAL="2" -> error # valores igual que ogUpdateCacheIsNecesary - [ $? == 0 ] && RETVAL="1"|| RETVAL="2" + [ ${PIPESTATUS[0]} == 0 ] && RETVAL="1"|| RETVAL="2" # Desmonto las imagenes ogUnmountImage CACHE "$IMGNAME" $IMGTYPE ogUnmountImage REPO "$IMGNAME" $IMGTYPE |