diff options
author | irina <irinagomez@us.es> | 2013-06-21 12:09:10 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2013-06-21 12:09:10 +0000 |
commit | 56b3a42f8f77d1d0c760cddb222bc0ecb381c767 (patch) | |
tree | d0dbf13f4dc1da8b418d1dc996fb558b85ea144c | |
parent | 30e0a236980390a94fb63a6b1a7a4345ca9157fa (diff) |
#565 script sincronizadas: aumenta la estimacion del tamaño imagen linux, cambio de opcions ls por cambio del comando y mensaje de error desconocido
git-svn-id: https://opengnsys.es/svn/branches/version1.0@3921 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | admin/Sources/Services/ogAdmRepoAux | 2 | ||||
-rwxr-xr-x | client/engine/Rsync.lib | 10 | ||||
-rwxr-xr-x | client/shared/scripts/createBaseImage | 14 | ||||
-rwxr-xr-x | client/shared/scripts/createDiffImage | 14 | ||||
-rwxr-xr-x | client/shared/scripts/restoreBaseImage | 4 | ||||
-rwxr-xr-x | client/shared/scripts/restoreDiffImage | 4 |
6 files changed, 23 insertions, 25 deletions
diff --git a/admin/Sources/Services/ogAdmRepoAux b/admin/Sources/Services/ogAdmRepoAux index e1d40406..d7ce37b1 100755 --- a/admin/Sources/Services/ogAdmRepoAux +++ b/admin/Sources/Services/ogAdmRepoAux @@ -90,7 +90,7 @@ case "$PARM1" in # Redimensionamos la imagen al tamaño necesario # TODO modificar ogGetImageSize - IMGSIZE=$(ls -lk $IMGFILE| cut -f5 -d" ") + IMGSIZE=$(ls -l --block-size=1024 $IMGFILE| cut -f5 -d" ") if [ $IMGSIZE -lt $SIZEREQUIRED ];then echolog "truncate --size=\">$SIZEREQUIRED\"k $IMGFILE" truncate --size=">$SIZEREQUIRED"k $IMGFILE 2>&1 > $REPOLOG diff --git a/client/engine/Rsync.lib b/client/engine/Rsync.lib index 8d89bcef..6911b185 100755 --- a/client/engine/Rsync.lib +++ b/client/engine/Rsync.lib @@ -44,7 +44,7 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then if [ -f "$IMGFILE" ]; then # Si la imagen esta montada la desmonto if [ -r "$DIRMOUNT/ogimg.info" ]; then - echolog "umount $DIRMOUNT" + echo "umount $DIRMOUNT" | tee -a $OGLOGSESSION $OGLOGFILE umount "$DIRMOUNT" [ $? -ne 0 ] && return $(ogRaiseError $OG_ERR_DONTUNMOUNT_IMAGE "$1 $2.$3"; echo $?) fi @@ -57,7 +57,7 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then rm -f "$IMGFILE.sum" fi - IMGSIZE=$(ls -lk $IMGFILE | awk '{print $5}') + IMGSIZE=$(ls -l --block-size=1024 $IMGFILE | awk '{print $5}') if [ $IMGSIZE -lt $SIZEREQUIRED ];then echo " $MSG_SYNC_RESIZE" | tee -a $OGLOGSESSION $OGLOGFILE echo " truncate --size=>$SIZEREQUIRED k $IMGFILE" | tee -a $OGLOGSESSION $OGLOGFILE @@ -579,15 +579,15 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then # Al montar se comprueba la existencia de la imagen DIRMOUNT=$(ogMountImage $1 $2 $IMGEXT) - AVAILABLE=$(df -k|grep $DIRMOUNT|awk '{print $4}') + AVAILABLE=$(df -k|grep "$DIRMOUNT$"|awk '{print $4}') # Si el espacio libre menor que 500Mb nos salimos [ $AVAILABLE -lt 500000 ] && return 0 # Reducimos el archivo de imagen: IMGDIR=$(ogGetParentPath "$1" "/$2") IMGFILE=${IMGDIR}/$(basename "/$2").$IMGEXT - USED=$(df -k|grep $DIRMOUNT|awk '{print $3}') - let ENDSIZE=USED+500000 + USED=$(df -k|grep "$DIRMOUNT$"|awk '{print $3}') + let ENDSIZE=$USED+500000 echo -e -n " btrfs filesystem resize "$ENDSIZE"k $DIRMOUNT \n " btrfs filesystem resize "$ENDSIZE"k $DIRMOUNT ogUnmountImage $1 $2 $IMGEXT diff --git a/client/shared/scripts/createBaseImage b/client/shared/scripts/createBaseImage index de8b4bff..eef3207d 100755 --- a/client/shared/scripts/createBaseImage +++ b/client/shared/scripts/createBaseImage @@ -11,7 +11,7 @@ #@return #@exception OG_ERR_FORMAT # 1 formato incorrecto. #@exception OG_ERR_PARTITION # 3 Error en partición de disco o en su sistema de archivos -#@exception OG_ERR_LOCKED # Imagen o particion bloqueada +#@exception OG_ERR_LOCKED # 4 Imagen o particion bloqueada #@exception OG_ERR_IMAGE # 5 Error en funcion ogCreateImage o ogRestoreImage. #@exception OG_ERR_NOTWRITE # 14 error de escritura #@exception OG_ERR_NOTCACHE # 15 si cache no existe 15 @@ -28,17 +28,18 @@ trap "onexit $1 $2 $3 \"$4\"" 1 2 3 6 9 14 15 ERR # Establecemos factor de compresion COMPRESS=90/100 -COMPRESSLINUX=70/100 +COMPRESSLINUX=80/100 # Si salimos con error demontamos la imagen y desbloqueamos la imagen y la particion function onexit() { local exit_status=$? - ogUnmountImage $3 "$4" $IMGEXT &>/dev/null - # Si la partición/imagen no estaba bloqueada -> la desbloqueo - [ $exit_status -ne 4 ] || ogUnlockImage "$3" "/$4.$IMGEXT" || ogUnlock $1 $2 + echo "$MSG_ERR_GENERIC $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION echo ogUnmountImage $3 "$4" $IMGEXT + ogUnmountImage $3 "$4" $IMGEXT &>/dev/null echo ogUnlockImage "$3" "/$4.$IMGEXT" + ogUnlockImage "$3" "/$4.$IMGEXT" echo ogUnlock $1 $2 + ogUnlock $1 $2 exit $exit_status } @@ -128,7 +129,6 @@ ogCheckFs $1 $2 &> $OGLOGCOMMAND || ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 echo " " > $OGLOGCOMMAND TIME2=$SECONDS - ogLockImage "$3" "/$4.$IMGEXT" # Si existe el fichero de la imagen se hace copia de seguridad y se redimensiona, si no existe se crea. @@ -169,7 +169,7 @@ echo " $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX7/60]m $[TIMEAUX7%60]s" | tee - #resumen de la operacion -IMGSIZE=$(ls -s $IMGFILE | cut -f1 -d" ") +IMGSIZE=$(ls -l --block-size=1024 $IMGFILE | cut -f5 -d" ") TIME=$[SECONDS-TIME1] echo "[100] $MSG_SCRIPTS_TIME_TOTAL $[TIME/60]m $[TIME%60]s" | tee -a $OGLOGSESSION $OGLOGFILE diff --git a/client/shared/scripts/createDiffImage b/client/shared/scripts/createDiffImage index 774999d9..e716851d 100755 --- a/client/shared/scripts/createDiffImage +++ b/client/shared/scripts/createDiffImage @@ -29,20 +29,18 @@ trap "onexit $1 $2 $3 \"$4\" \"$5\"" 1 2 3 6 9 14 15 ERR function onexit() { local exit_status=$? + echo "$MSG_ERR_GENERIC $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION ogUnmountImage $3 "$5" $DIFFEXT &>/dev/null ogUnmountImage $3 "$4" $IMGEXT &>/dev/null - # Si la partición/imagen no estaba bloqueada -> la desbloqueo - if [ $exit_status -ne 4 ]; then - ogUnlockImage "$3" "/$4.$IMGEXT" &>/dev/null - ogUnlockImage "$3" "/$5.$DIFFEXT" &>/dev/null - ogUnlock $1 $2 &>/dev/null - fi + ogUnlockImage "$3" "/$4.$IMGEXT" &>/dev/null + ogUnlockImage "$3" "/$5.$DIFFEXT" &>/dev/null + ogUnlock $1 $2 &>/dev/null exit $exit_status } # Establecemos factor de compresion COMPRESS=90/100 -COMPRESSLINUX=70/100 +COMPRESSLINUX=80/100 #Carga el configurador del engine desde el fichero engine.cfg [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg @@ -204,7 +202,7 @@ ogUnlock $1 $2 file "$DIFFFILE" |grep "BTRFS Filesystem" >/dev/null || ogRaiseError $OG_ERR_IMAGE "$3 $4" #resumen de la operacion -IMGSIZE=$(ls -s ${DIFFFILE[CACHE]}| cut -f1 -d" ") +IMGSIZE=$(ls -l --block-size=1024 ${DIFFFILE}| cut -f5 -d" ") TIME=$[SECONDS-TIME1] echo "[100] $MSG_SCRIPTS_TIME_TOTAL $[TIME/60]m $[TIME%60]s" | tee -a $OGLOGSESSION $OGLOGFILE echo " FileSystem $PART with $SIZEDATA KB data created onto file-image as $4 and used $IMGSIZE KB acros DFS rsync " | tee -a $OGLOGSESSION $OGLOGFILE diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage index d2e3c6a1..c684e6a3 100755 --- a/client/shared/scripts/restoreBaseImage +++ b/client/shared/scripts/restoreBaseImage @@ -29,9 +29,9 @@ trap "onexit $1 \"$2\" $3 $4" 1 2 3 6 9 14 15 ERR # Si salimos con error demontamos la imagen y desbloqueamos la imagen y la particion function onexit() { local exit_status=$? + echo "$MSG_ERR_GENERIC $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION ogUnmountImage "$1" "$2" "$IMGEXT" &>/dev/null - # Si la partición/imagen no estaba bloqueada -> la desbloqueo - [ $exit_status -eq 4 ] && ogUnlock $3 $4 &>/dev/null + ogUnlock $3 $4 &>/dev/null exit $exit_status } diff --git a/client/shared/scripts/restoreDiffImage b/client/shared/scripts/restoreDiffImage index 2f986bd7..f393d1d6 100755 --- a/client/shared/scripts/restoreDiffImage +++ b/client/shared/scripts/restoreDiffImage @@ -29,9 +29,9 @@ trap "onexit $1 \"$2\" $3 $4" 1 2 3 6 9 14 15 ERR # Si salimos con error demontamos la imagen y desbloqueamos la imagen y la particion function onexit() { local exit_status=$? + echo "$MSG_ERR_GENERIC $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION ogUnmountImage "$1" "$2" "$DIFFEXT" &>/dev/null - # Si la partición no estaba bloqueada -> la desbloqueo - [ $exit_status -eq 4 ] || ogUnlock $3 $4 &>/dev/null + ogUnlock $3 $4 &>/dev/null exit $exit_status } |