diff options
author | irina <irinagomez@us.es> | 2014-02-21 13:45:57 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2014-02-21 13:45:57 +0000 |
commit | 791d013b4d86ae2be0e6e09205c22f4a34d6603e (patch) | |
tree | edf423a74a3e68dbc47c3be2362eb3f7fb8f6286 | |
parent | 32ac61d80984c108215d553e49216a7edca06c9e (diff) |
#565 #537 #636 Log en tiempo real para imagenes sincronizadas.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4153 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | admin/Interface/CrearImagenBasica | 10 | ||||
-rwxr-xr-x | admin/Interface/CrearSoftIncremental | 11 | ||||
-rwxr-xr-x | admin/Interface/RestaurarImagenBasica | 5 | ||||
-rwxr-xr-x | admin/Interface/RestaurarSoftIncremental | 5 | ||||
-rwxr-xr-x | client/engine/Rsync.lib | 59 | ||||
-rwxr-xr-x | client/shared/scripts/createBaseImage | 76 | ||||
-rwxr-xr-x | client/shared/scripts/createDiffImage | 81 | ||||
-rwxr-xr-x | client/shared/scripts/deployImage | 2 | ||||
-rwxr-xr-x | client/shared/scripts/restoreBaseImage | 12 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 14 |
10 files changed, 142 insertions, 133 deletions
diff --git a/admin/Interface/CrearImagenBasica b/admin/Interface/CrearImagenBasica index f302aa8e..7efc69e2 100755 --- a/admin/Interface/CrearImagenBasica +++ b/admin/Interface/CrearImagenBasica @@ -44,6 +44,13 @@ #Carga el configurador del engine desde el fichero engine.cfg [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg + # Clear temporary file used as log track by httpdlog + # Limpia los ficheros temporales usados como log de seguimiento para httpdlog + echo -n "" > $OGLOGSESSION; echo -n "" > $OGLOGCOMMAND + + # Registro de inicio de ejecución + echo "$MSG_INTERFACE_START $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE + # Si el destino es REPO y el cliente no está en modo "admin"; activar repositorio para escritura, if [ "$REPO" == "REPO" -a "$boot" != "admin" ] then @@ -52,9 +59,6 @@ [ $RETVAL -gt 0 ] && exit $RETVAL fi - # Clear temporary file used as log track by httpdlog - # Limpia los ficheros temporales usados como log de seguimiento para httpdlog - echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND; echo " " > ${OGLOGCOMMAND}.tmp if [ $7 -eq 1 ]; then #sincronizacion1 diff --git a/admin/Interface/CrearSoftIncremental b/admin/Interface/CrearSoftIncremental index 9fe6df8f..ccf8d70f 100755 --- a/admin/Interface/CrearSoftIncremental +++ b/admin/Interface/CrearSoftIncremental @@ -43,6 +43,13 @@ #Carga el configurador del engine desde el fichero engine.cfg [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg + # Clear temporary file used as log track by httpdlog + # Limpia los ficheros temporales usados como log de seguimiento para httpdlog + echo -n "" > $OGLOGSESSION; echo -n "" > $OGLOGCOMMAND + + # Registro de inicio de ejecución + echo "$MSG_INTERFACE_START $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE + # Si el destino es REPO y el cliente no está en modo "admin"; activar repositorio para escritura, if [ "$REPO" == "REPO" -a "$boot" != "admin" ] then @@ -52,10 +59,6 @@ fi - # Clear temporary file used as log track by httpdlog - # Limpia los ficheros temporales usados como log de seguimiento para httpdlog - echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND; echo " " > ${OGLOGCOMMAND}.tmp - if [ $8 -eq 1 ]; then #sincronizacion1 ogCrearSoftIncremental "$@" diff --git a/admin/Interface/RestaurarImagenBasica b/admin/Interface/RestaurarImagenBasica index 8fc169df..be088cc5 100755 --- a/admin/Interface/RestaurarImagenBasica +++ b/admin/Interface/RestaurarImagenBasica @@ -47,9 +47,10 @@ # Clear temporary file used as log track by httpdlog # Limpia los ficheros temporales usados como log de seguimiento para httpdlog - echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND; echo " " > ${OGLOGCOMMAND}.tmp + echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND - + # Registro de inicio de ejecución + echo "$MSG_INTERFACE_START $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE if [ $9 -eq 1 ]; then #sincronizacion1 diff --git a/admin/Interface/RestaurarSoftIncremental b/admin/Interface/RestaurarSoftIncremental index b8d4af5d..f889547b 100755 --- a/admin/Interface/RestaurarSoftIncremental +++ b/admin/Interface/RestaurarSoftIncremental @@ -39,7 +39,10 @@ # Clear temporary file used as log track by httpdlog # Limpia los ficheros temporales usados como log de seguimiento para httpdlog - echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND; echo " " > ${OGLOGCOMMAND}.tmp + echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND + + # Registro de inicio de ejecución + echo "$MSG_INTERFACE_START $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE if [ ${10} -eq 1 ]; then diff --git a/client/engine/Rsync.lib b/client/engine/Rsync.lib index 13b6035e..b38dc4e1 100755 --- a/client/engine/Rsync.lib +++ b/client/engine/Rsync.lib @@ -53,7 +53,7 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then if [ "$BACKUP" == "true" ]; then # Copia seguridad echo " $MSG_SCRIPTS_FILE_RENAME \"$IMGFILE\" -> \"$IMGFILE.ant\"." | tee -a $OGLOGSESSION $OGLOGFILE - cp -f "$IMGFILE" "$IMGFILE.ant" &> $OGLOGCOMMAND + cp -f "$IMGFILE" "$IMGFILE.ant" mv -f "$IMGFILE.torrent" "$IMGFILE.torrent.ant" 2>/dev/null rm -f "$IMGFILE.sum" fi @@ -79,17 +79,17 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then fi else echo " dd if=/dev/zero of=$IMGFILE bs=1024 count=$SIZEREQUIRED" - dd if=/dev/zero of="$IMGFILE" bs=1024 count=$SIZEREQUIRED &> $OGLOGCOMMAND + dd if=/dev/zero of="$IMGFILE" bs=1024 count=$SIZEREQUIRED 2>&1 | tee -a $OGLOGCOMMAND #Formateamos imagen losetup $LOOPDEVICE $IMGFILE # FS de la imagen segun la version del kernel: < 3.7 ext4, si >= btrfs #if [[ "$(uname -r)" < "3.7" ]]; then if [ $(uname -r|cut -d. -f2) -lt 7 ]; then echo " mkfs.ext4 -i 4096 -b 4096 -L "${2##*\/}" $LOOPDEVICE" - mkfs.ext4 -i 4096 -b 4096 -L "${2##*\/}" $LOOPDEVICE &> $OGLOGCOMMAND + mkfs.ext4 -i 4096 -b 4096 -L "${2##*\/}" $LOOPDEVICE 2>&1 |tee -a $OGLOGCOMMAND else echo " mkfs.btrfs -L ${2##*\/} $LOOPDEVICE " - mkfs.btrfs -L "${2##*\/}" $LOOPDEVICE &> $OGLOGCOMMAND + mkfs.btrfs -L "${2##*\/}" $LOOPDEVICE 2>&1 | tee -a $OGLOGCOMMAND fi fi # Monto la imagen @@ -192,7 +192,7 @@ if [ "$IMGTYPE" == "img" ]; then else # Imagen Diferencial echo " rsync -aHAXvn$OPTRSYNC --delete $ORIG/ $DESTRSYNC a $IMGLIST" | tee -a $OGLOGSESSION $OGLOGFILE - rsync -aHAXvn$OPTRSYNC $PASSWORD --delete "$ORIG/" "$DESTRSYNC" >> $IMGLIST + rsync -aHAXvn$OPTRSYNC $PASSWORD --delete "$ORIG/" "$DESTRSYNC" >> $IMGLIST sed -i -e s/"^sent.*.bytes\/sec"//g -e s/^total.*.speedup.*.$//g -e s/"sending.*.list"//g $IMGLIST sed -i '/^\.\//d' $IMGLIST @@ -204,15 +204,22 @@ else rm $IMGLIST + # Comprobamos que los ficheros de diferencias no esten vacios o salimos con error. + if [ $(grep -v -e "^$" -e "^#" $IMGINFO /tmp/ogimg.ln /tmp/ogimg.rm |wc -l) -eq 0 ]; then + ogRaiseError $OG_ERR_NOTDIFERENT "$1 $2 $3 $4 $5" 2>&1 | tee -a $OGLOGSESSION $OGLOGFILE + return ${PIPESTATUS[0]} + fi + fi # Guardamos el contenido de las acl (Solo win) Necesario particion desmontada (esta asi) ogUnmount $1 $2 if [ $FSTYPE == "NTFS" ]; then echo " ntfs-3g.secaudit -b $PART /" |tee -a $OGLOGSESSION $OGLOGFILE - ntfs-3g.secaudit -b $PART / > $IMGACL + ntfs-3g.secaudit -b $PART / > $IMGACL 2>$OGLOGCOMMAND fi + } @@ -245,7 +252,7 @@ while read LINE; do read END INI <<< "$(grep -n -e "File" -e "Directory" $IMGACL| grep -A 1 "$LINE"| awk -F : '!(NR%2){print $1" "p}{p=$1}' )" let NUM=$END-$INI-1 # Si algún archivo no se encuentra, el error lo mandamos a /dev/null - sed -n -e $INI,+"$NUM"p $IMGACL 2>/dev/null | tee -a $ACLTMP > $OGLOGCOMMAND + sed -n -e $INI,+"$NUM"p $IMGACL 2>/dev/null | tee -a $ACLTMP done < $FILES cp $ACLTMP $IMGACL @@ -316,7 +323,7 @@ if [ "$(ogGetFsType $1 $2)" == "NTFS" -a -f "$DEST/$IMGACL" ] ; then cp "$DEST/$IMGACL" /tmp ogUnmount "$1" "$2" echo " ntfs-3g.secaudit -se $PART" |tee -a $OGLOGSESSION $OGLOGFILE - ntfs-3g.secaudit -se $PART /tmp/$IMGACL + ntfs-3g.secaudit -se $PART /tmp/$IMGACL # Para evitar que de falso error echo "" fi @@ -335,6 +342,9 @@ function ogSyncCreate () { #*/ local ORIG DIRAUX DIRMOUNT DESTRSYNC USERRSYNC PASSWORD OPTRSYNC +# Limpiamos los archivo de log +echo "" >$OGLOGCOMMAND; + if [ "$*" == "help" ]; then ogHelp "$FUNCNAME": "$MSG_HELP_ogSyncCreate" \ "$FUNCNAME num_disk num_part [ REPO|CACHE ] image_name extension " \ @@ -371,10 +381,10 @@ else DESTRSYNC="$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT" fi # Sincronizamos los datos de la partición a la imagen -echo " rsync -aHAX$OPTRSYNC --inplace --delete $FILESFROM $ORIG/ $DESTRSYNC" | tee -a $OGLOGSESSION $OGLOGFILE -rsync -aHAXq$OPTRSYNC $PASSWORD --inplace --delete $FILESFROM "$ORIG/" "$DESTRSYNC" +echo " rsync -aHAX$OPTRSYNC --progress --inplace --delete $FILESFROM $ORIG/ $DESTRSYNC" | tee -a $OGLOGSESSION $OGLOGFILE +rsync -aHAX$OPTRSYNC $PASSWORD --progress --inplace --delete $FILESFROM "$ORIG/" "$DESTRSYNC" 2>&1| egrep "^sent|^sending|^total|%" >> $OGLOGCOMMAND echo " rsync -aHAX$OPTRSYNC --inplace /tmp/ogimg* $DESTRSYNC" | tee -a $OGLOGSESSION $OGLOGFILE -rsync -aHAXq$OPTRSYNC $PASSWORD --inplace /tmp/ogimg* "$DESTRSYNC" +rsync -aHAX$OPTRSYNC $PASSWORD --inplace /tmp/ogimg* "$DESTRSYNC" } @@ -391,6 +401,9 @@ rsync -aHAXq$OPTRSYNC $PASSWORD --inplace /tmp/ogimg* "$DESTRSYNC" function ogSyncRestore () { local DIRMOUNT ORIG DESTRSYNC PASSWORD OPTRSYNC USERRSYNC IMGINFO FILESFROM +# Limpiamos los archivo de log +echo "" >$OGLOGCOMMAND; + if [ "$*" == "help" ]; then ogHelp "$FUNCNAME": "$MSG_HELP_ogSyncRestore" \ "$FUNCNAME [ REPO|CACHE ] image_name extension num_disk num_part " \ @@ -438,8 +451,8 @@ if [ "$3" == "diff" ]; then IMGINFO="ogimg.info" FILESFROM=" --files-from=$DESTRSYNC/$IMGINFO" - echo " rsync -aHAXq$OPTRSYNC $ORIG/ogimg* $DESTRSYNC" |tee -a $OGLOGFILE - rsync -aHAXq$OPTRSYNC $PASSWORD "$ORIG"/ogimg* $DESTRSYNC + echo " rsync -aHAX$OPTRSYNC --progress $ORIG/ogimg* $DESTRSYNC" |tee -a $OGLOGSESSION $OGLOGFILE + rsync -aHAX$OPTRSYNC $PASSWORD --progress "$ORIG"/ogimg* $DESTRSYNC # Borramos linea de información de la imagen, sino busca un fichero con ese nombre sed -i '/^\#/d' $DESTRSYNC/$IMGINFO @@ -450,8 +463,8 @@ if [ "$3" == "diff" ]; then fi -echo " rsync -aHAX$OPTRSYNC $FILESFROM $ORIG/ $DESTRSYNC" | tee -a $OGLOGSESSION $OGLOGFILE -rsync -aHAXq$OPTRSYNC $PASSWORD $FILESFROM "$ORIG/" "$DESTRSYNC" +echo " rsync -aHAX$OPTRSYNC --progress $FILESFROM $ORIG/ $DESTRSYNC" | tee -a $OGLOGSESSION $OGLOGFILE +rsync -aHAX$OPTRSYNC $PASSWORD --progress $FILESFROM "$ORIG/" "$DESTRSYNC" 2>&1 | egrep "^sent|^sending|^total|%" >> $OGLOGCOMMAND } @@ -608,11 +621,10 @@ if [ "$*" == "help" ]; then fi if [ $# -lt 2 ]; then - ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO | CACHE ] image_name extension [ image_size ] " - return $? + ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO | CACHE ] image_name extension [ image_size ] " 2>&1 | tee -a $OGLOGSESSION $OGLOGFILE + return ${PIPESTATUS[0]} fi - SIZE=${4:-"300000"} if [ "$1" == "CACHE" -o "$1" == "cache" ]; then @@ -621,18 +633,19 @@ else DIRMOUNT="$OGIMG/$(ogGetMountImageDir "$2" $3)" fi -echo -n -e " $MSG_SYNC_SLEEP: $DIRMOUNT\n #" +echo -n -e " $MSG_SYNC_SLEEP: $DIRMOUNT\n #" | tee -a $OGLOGSESSION $OGLOGFILE # time-out segun el tamaño de la imagen. por defecto: 100000k -> 3s let TIMEOUT=$SIZE/$CREATESPEED [ $TIMEOUT -lt 60 ] && TIMEOUT=60 until [ -f "$DIRMOUNT/ogimg.info" ] ; do TIMEAUX=$[SECONDS-TIME] - [ "$TIMEAUX" -gt "$TIMEOUT" ] && return 2 - echo -n "#" + [ "$TIMEAUX" -lt "$TIMEOUT" ] || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 $IMGEXT" 2>&1 | tee -a $OGLOGSESSION $OGLOGFILE + [ ${PIPESTATUS[0]} -eq 0 ] || return ${PIPESTATUS[0]} + echo -n "#" | tee -a $OGLOGSESSION $OGLOGFILE sleep 5 done -echo "" +echo "" | tee -a $OGLOGSESSION $OGLOGFILE } @@ -797,7 +810,7 @@ if [ $(uname -r|cut -d. -f2) -lt 7 ]; then else mount -o compress=lzo "$IMGFILE" "$DIRMOUNT" 1>/dev/null fi -ls "$DIRMOUNT" +ls -C "$DIRMOUNT" | tee -a $OGLOGCOMMAND umount "$DIRMOUNT" rmdir "$DIRMOUNT" diff --git a/client/shared/scripts/createBaseImage b/client/shared/scripts/createBaseImage index 09999e9b..50e41952 100755 --- a/client/shared/scripts/createBaseImage +++ b/client/shared/scripts/createBaseImage @@ -26,14 +26,10 @@ trap "onexit $1 $2 $3 \"$4\"" 1 2 3 6 9 14 15 ERR -# Establecemos factor de compresion -# !!! Se configura en las lineas 110 y 116. - # Si salimos con error demontamos la imagen y desbloqueamos la imagen y la particion function onexit() { local exit_status=$? - local MSG="$(ogRaiseError $exit_status \"$1 $2 $3 $4\" 2>&1)" - echo "$MSG" |tee -a $OGLOGFILE $OGLOGSESSION + echo -e "\n $PROG error ${MSG_INTERFACE_END#*\]} $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION ogUnmountImage $3 "$4" $IMGEXT &>/dev/null if [ $exit_status -ne 4 ]; then ogUnlockImage "$3" "/$4.$IMGEXT" @@ -48,8 +44,14 @@ TIME1=$SECONDS # Factor de calculo de Time out al crear imagen: valor por defecto en engine.cfg CREATESPEED=${CREATESPEED:-"100000*4"} + # Sistema de fichero de la imagen según kernel, menor que 3.7 EXT4. comparamos revision [ $(uname -r|cut -d. -f2) -lt 7 ] && IMGFS="EXT4" || IMGFS="BTRFS" +# % de compresion para estimacion tamaño imagen IMGFS="EXT4" +ZSYNC=${ZSYNC:-"120"} + +# Si IMGFS="BTRFS" la compresion es mayor. +[ $IMGFS == "BTRFS" ] && let ZSYNC=$ZSYNC-30 PROG="$(basename $0)" # Si se solicita, mostrar ayuda. @@ -57,19 +59,18 @@ if [ "$*" == "help" ]; then ogHelp "$PROG: $MSG_HELP_createBaseImage" \ "$PROG ndisco nparticion REPO|CACHE base_image" \ "$PROG 1 1 REPO Windows7" - exit 0 + exit 0 fi [ $# -ne 4 ] && ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG ndisco nparticion REPO|CACHE imagen" # Limpiamos fichero de log -echo -n ""> $OGLOGSESSION echo " " > $OGLOGCOMMAND +[ "$(ogGetCaller)" == "RestaurarImagenBasica" ] || echo -n ""> $OGLOGSESSION echo "[1] $MSG_SCRIPTS_START $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE - # Valores por defecto en etc/engine.cfg IMGEXT="img" REPOIP=$(ogGetRepoIp) @@ -84,53 +85,52 @@ if [ "$3" == "CACHE" -o "$3" == "cache" ]; then ! ogFindCache >/dev/null && ogRaiseError $OG_ERR_NOTCACHE "CACHE " fi +#Comprobamos acceso de escritura. +DIRTEMP="/$4$(date +%Y%m%d-%H%M%S)" +ogMakeDir $3 "$DIRTEMP" 2>/dev/null || ogRaiseError $OG_ERR_NOTWRITE "$3" && ogDeleteTree $3 "$DIRTEMP" # Obtener información de los parámetros de entrada. PART=$(ogDiskToDev "$1" "$2" 2>/dev/null) || ogRaiseError $OG_ERR_PARTITION "$1 $2" +# Comprobar consistencia del sistema de archivos. +echo " " > $OGLOGCOMMAND +SIZEFS=$(ogGetFsSize $1 $2) +echo "[20] $MSG_HELP_ogCheckFs $PART $SIZEFS (KB) " | tee -a $OGLOGSESSION $OGLOGFILE +ogUnmount $1 $2 +ogCheckFs $1 $2 &> $OGLOGCOMMAND || ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 $2" + # Comprobamos que la particion se puede montar ORIG=$(ogMount $1 $2) || ogRaiseError $OG_ERR_PARTITION "$1 $2" -#Comprobamos acceso de escritura. -DIRTEMP="/$4$(date +%Y%m%d-%H%M%S)" -ogMakeDir $3 "$DIRTEMP" 2>/dev/null || ogRaiseError $OG_ERR_NOTWRITE "$3" && ogDeleteTree $3 "$DIRTEMP" # Borramos ficheros de paginacion y configuracion case "$(ogGetFsType $1 $2)" in EXT[234]) ogCleanLinuxDevices $1 $2 rm -rf $ORIG/tmp/* - # Compresion linux && ext4 || btrfs - [ $IMGFS == "EXT4" ] && COMPRESS=110/100 || COMPRESS=80/100 ;; NTFS) - [ $(ogGetPath $1 $2 pagefile.sys) ] && ogDeleteFile $1 $2 pagefile.sys - [ $(ogGetPath $1 $2 hiberfil.sys) ] && ogDeleteFile $1 $2 hiberfil.sys - # Compresion windows && ext4 || btrfs - [ $IMGFS == "EXT4" ] && COMPRESS=120/100 || COMPRESS=90/100 + [ $(ogGetPath $1 $2 pagefile.sys) ] && ogDeleteFile $1 $2 pagefile.sys + [ $(ogGetPath $1 $2 hiberfil.sys) ] && ogDeleteFile $1 $2 hiberfil.sys + [ $(ogGetPath $1 $2 swapfile.sys) ] && ogDeleteFile $1 $2 swapfile.sys ;; esac + #Comprobar espacio que requerira la imagen para ser almacenada SIZEDATA=$(df -k | grep $PART | awk '{print $3}') #Aplicar factor de compresion -let SIZEREQUIRED=$SIZEDATA*$COMPRESS +let SIZEREQUIRED=$SIZEDATA*$ZSYNC/100 # El tamaño mínimo del sistema de ficheros btrfs es 250M, ponemos 300 [ $SIZEREQUIRED -lt 300000 ] && SIZEREQUIRED=300000 #Comprobar espacio libre en el contenedor. [ "$3" == "CACHE" -o "$3" == "cache" ] && SIZEFREE=$(ogGetFreeSize `ogFindCache`) [ "$3" == "REPO" -o "$3" == "repo" ] && SIZEFREE=$(df -k | grep $OGIMG | awk '{print $4}') -echo "[16]$MSG_SCRIPTS_CREATE_SIZE $SIZEREQUIRED $SIZEFREE" | tee -a $OGLOGSESSION $OGLOGFILE +echo " $MSG_SCRIPTS_CREATE_SIZE $SIZEREQUIRED $SIZEFREE" | tee -a $OGLOGSESSION $OGLOGFILE [ $SIZEREQUIRED -gt $SIZEFREE ] && ogRaiseError $OG_ERR_CACHESIZE "$3" IMGDIR="$(ogGetParentPath "$3" "/$4")" IMGFILE=${IMGDIR[$3]}/$(basename "/$4").$IMGEXT -# Comprobar consistencia del sistema de archivos. -echo " " > $OGLOGCOMMAND -SIZEFS=$(ogGetFsSize $1 $2) -echo "[20] $MSG_HELP_ogCheckFs $PART $SIZEFS (KB) " | tee -a $OGLOGSESSION $OGLOGFILE -ogUnmount $1 $2 -ogCheckFs $1 $2 &> $OGLOGCOMMAND || ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 $2" # Crear la imagen. echo " " > $OGLOGCOMMAND @@ -138,26 +138,28 @@ TIME2=$SECONDS ogLockImage "$3" "/$4.$IMGEXT" +echo "[40] $MSG_HELP_ogCreateImage $1 $2 $3 $4 " | tee -a $OGLOGSESSION $OGLOGFILE # Si existe el fichero de la imagen se hace copia de seguridad y se redimensiona, si no existe se crea. -echo "[30] $MSG_HELP_ogCreateFileImage." | tee -a $OGLOGSESSION $OGLOGFILE +echo "[50] $MSG_HELP_ogCreateFileImage." | tee -a $OGLOGSESSION $OGLOGFILE ogCreateFileImage $3 "$4" $IMGEXT $SIZEREQUIRED # Creamos la lista del contenido y lo situamos en la particion a copiar. -echo "[50] $MSG_HELP_ogCreateImage $1 $2 $3 $4 " | tee -a $OGLOGSESSION $OGLOGFILE -echo " $MSG_HELP_ogCreateInfoImage" | tee -a $OGLOGSESSION $OGLOGFILE +echo "[60] $MSG_HELP_ogCreateInfoImage" | tee -a $OGLOGSESSION $OGLOGFILE ogCreateInfoImage $1 $2 $IMGEXT TIMEAUX3=$[SECONDS-TIME2] echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE # Esperamos que el servidor termine de crear y montar la imagen -ogWaitMountImage "$3" "$4" $IMGEXT $SIZEREQUIRED || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 $IMGEXT: time_out." - +ogWaitMountImage "$3" "$4" $IMGEXT $SIZEREQUIRED # Sincronizamos los datos de la particion con la imagen. -echo " $MSG_HELP_ogSyncCreate." | tee -a $OGLOGSESSION $OGLOGFILE +echo "[70] $MSG_HELP_ogSyncCreate." | tee -a $OGLOGSESSION $OGLOGFILE ogSyncCreate $1 $2 $3 "$4" $IMGEXT +TIMEAUX5=$[SECONDS-TIMEAUX3] +echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX5/60]m $[TIMEAUX5%60]s" | tee -a $OGLOGSESSION $OGLOGFILE + # Reducimos la imagen: solo para kernel <= 3.7, imagenes con FS ext4. echo "[80] $MSG_HELP_ogReduceImage: $3 /$4.$IMGEXT" | tee -a $OGLOGSESSION $OGLOGFILE ogReduceImage $3 "$4" $IMGEXT @@ -166,18 +168,12 @@ ogReduceImage $3 "$4" $IMGEXT ogUnmountImage $3 "$4" $IMGEXT ogUnlockImage "$3" "/$4.$IMGEXT" ogUnlock $1 $2 -TIMEAUX5=$[SECONDS-TIMEAUX3] -echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE +echo " " > $OGLOGCOMMAND # Comprobamos que la imagen esta bien detectacdo que es un sistema de ficheros. echo "[95] $MSG_HELP_ogCheckSyncImage" | tee -a $OGLOGSESSION $OGLOGFILE -ogCheckSyncImage $3 "$4" "img" | tee -a $OGLOGSESSION $OGLOGFILE -RETVAL=${PIPESTATUS[0]} -[ "$RETVAL" == "0" ] || ogRaiseError $OG_ERR_IMAGE "$3 $4 img" - - -TIMEAUX7=$[SECONDS-TIME2] -echo " $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX7/60]m $[TIMEAUX7%60]s" | tee -a $OGLOGSESSION $OGLOGFILE +ogCheckSyncImage $3 "$4" "img" +[ $? -eq 0 ] || ogRaiseError $OG_ERR_IMAGE "$3 $4 img" #resumen de la operacion diff --git a/client/shared/scripts/createDiffImage b/client/shared/scripts/createDiffImage index 16b266f1..08276383 100755 --- a/client/shared/scripts/createDiffImage +++ b/client/shared/scripts/createDiffImage @@ -28,13 +28,9 @@ #*/ ## trap "onexit $1 $2 $3 \"$4\" \"$5\"" 1 2 3 6 9 14 15 ERR -# Establecemos factor de compresion -# !!! Se configura en las lineas 122 y 128. - function onexit() { local exit_status=$? - local MSG="$(ogRaiseError $exit_status \"$1 $2 $3 $4 $5\" 2>&1)" - echo "$MSG" |tee -a $OGLOGFILE $OGLOGSESSION + echo -e "\n $PROG error: ${MSG_INTERFACE_END#*\]} $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION ogUnmountImage $3 "$5" $DIFFTYPE &>/dev/null ogUnmountImage $3 "$4" $IMGEXT &>/dev/null if [ $exit_status -ne 4 ]; then @@ -52,6 +48,11 @@ function onexit() { CREATESPEED=${CREATESPEED:-"100000*4"} # Sistema de fichero de la imagen según kernel, menor que 3.7 EXT4. comparamos revision [ $(uname -r|cut -d. -f2) -lt 7 ] && IMGFS="EXT4" || IMGFS="BTRFS" +# % de compresion para estimacion tamaño imagen IMGFS="EXT4" +ZSYNC=${ZSYNC:-"120"} +# Si IMGFS="BTRFS" la compresion es mayor. +[ $IMGFS == "BTRFS" ] && let ZSYNC=$ZSYNC-30 + TIME1=$SECONDS @@ -72,7 +73,8 @@ DIFFEXT="img.diff" DIFFTYPE="diff" # Limpiamos los archivo de log -echo -n "" >$OGLOGCOMMAND; echo -n "" $OGLOGSESSION +echo -n "" >$OGLOGCOMMAND +[ "$(ogGetCaller)" == "RestaurarSoftIncremental" ] || echo -n "" > $OGLOGSESSION echo "[1] $MSG_SCRIPTS_START $0 $*" | tee -a $OGLOGSESSION $OGLOGFILE @@ -108,7 +110,6 @@ DIFFFILE="$DIFFDIR/$5.$DIFFEXT" ogLockImage "$3" "/$4.$IMGEXT" ogLockImage "$3" "/$5.$DIFFEXT" -LOOPDEVICE=$(losetup -f) # Comprobar consistencia del sistema de archivos. echo " " > $OGLOGCOMMAND @@ -117,23 +118,18 @@ echo "[20] $MSG_HELP_ogCheckFs $1 $2 $SIZEFS (KB) " | tee -a $OGLOGSESSION $OGL ogUnmount $1 $2 ogCheckFs $1 $2 >$OGLOGCOMMAND || ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 $2" -TIMEAUX1=$[SECONDS-TIME1] -echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX1/60]m $[TIMEAUX1%60]s" | tee -a $OGLOGSESSION $OGLOGFILE # Borramos ficheros de paginacion y configuracion -# Establecemos factor de compresion, varia segun el sistema operativo y el kernel. -case "$(ogGetFsType $1 $2)" in +FSTYPE=$(ogGetFsType $1 $2) +case "$FSTYPE" in EXT[234]) ogCleanLinuxDevices $1 $2 rm -rf $ORIG/tmp/* - # Compresion linux && ext4 || btrfs - [ $IMGFS == "EXT4" ] && COMPRESS=110/100 || COMPRESS=80/100 ;; NTFS) - [ $(ogGetPath $1 $2 pagefile.sys) ] && ogDeleteFile $1 $2 pagefile.sys - [ $(ogGetPath $1 $2 hiberfil.sys) ] && ogDeleteFile $1 $2 hiberfil.sys - # Compresion windows && ext4 || btrfs - [ $IMGFS == "EXT4" ] && COMPRESS=130/100 || COMPRESS=90/100 + [ $(ogGetPath $1 $2 pagefile.sys) ] && ogDeleteFile $1 $2 pagefile.sys + [ $(ogGetPath $1 $2 hiberfil.sys) ] && ogDeleteFile $1 $2 hiberfil.sys + [ $(ogGetPath $1 $2 swapfile.sys) ] && ogDeleteFile $1 $2 swapfile.sys ;; esac @@ -142,9 +138,6 @@ echo " " > $OGLOGCOMMAND TIME2=$SECONDS echo "[40] $MSG_HELP_createDiffImage: $1 $2 $3 $4" | tee -a $OGLOGSESSION $OGLOGFILE # Creamos la lista del contenido y lo situamos en la particion a copiar. -FSTYPE=$(ogGetFsType $1 $2) - -IMGDIRAUX=$(ogGetMountImageDir "$4" $IMGEXT) # Montamos imagen completa (con la que vamos a comparar) ogMountImage $3 "$4" $IMGEXT >/dev/null @@ -155,24 +148,14 @@ ogWaitMountImage $3 "$4" $IMGEXT || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 # Creamos la informacion de la imagen. echo "[50] $MSG_HELP_ogCreateInfoImage " | tee -a $OGLOGSESSION $OGLOGFILE ogCreateInfoImage $1 $2 $3 "$4" "${DIFFTYPE}" -TIMEAUX3=$[SECONDS-TIME2] -echo " $MSG_SCRIPTS_TASK_END $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE - -# Del fichero de acl de la partición extraemos las acl de los ficheros de la diferencial -echo "[60] $MSG_HELP_ogAclFilter " | tee -a $OGLOGSESSION $OGLOGFILE -ogAclFilter -TIMEAUX5=$[SECONDS-TIMEAUX3] -echo " $MSG_SCRIPTS_TASK_END $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX5/60]m $[TIMEAUX5%60]s" | tee -a $OGLOGSESSION $OGLOGFILE - #Calculamos el tamaño de la imagen: ogMount $1 $2 >/dev/null ogLock $1 $2 - echo -n " $MSG_SCRIPTS_CREATE_SIZE" | tee -a $OGLOGSESSION $OGLOGFILE cd $ORIG SIZEDATA=$(grep -v "\/$" /tmp/ogimg.info | tr '\n' '\0'| du -x -c --files0-from=- 2>/dev/null|tail -n1 |cut -f1) -let SIZEREQUIRED=$SIZEDATA*$COMPRESS +let SIZEREQUIRED=$SIZEDATA*$ZSYNC/100 # Tamaño minimo fichero imagen 300000 [ $SIZEREQUIRED -lt 300000 ] && SIZEREQUIRED=300000 @@ -182,21 +165,34 @@ let SIZEREQUIRED=$SIZEDATA*$COMPRESS echo " $SIZEREQUIRED $SIZEFREE" | tee -a $OGLOGSESSION $OGLOGFILE [ $SIZEREQUIRED -gt $SIZEFREE ] && ogRaiseError $OG_ERR_CACHESIZE "$3" +TIMEAUX3=$[SECONDS-TIME2] +echo " $MSG_SCRIPTS_TASK_END $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE + +# Del fichero de acl de la partición extraemos las acl de los ficheros de la diferencial +if [ "$FSTYPE" == "NTFS" ]; then + echo "[55] $MSG_HELP_ogAclFilter " | tee -a $OGLOGSESSION $OGLOGFILE + ogAclFilter + TIMEAUX4=$[SECONDS-TIMEAUX3] + echo " $MSG_SCRIPTS_TASK_END $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX4/60]m $[TIMEAUX4%60]s" | tee -a $OGLOGSESSION $OGLOGFILE +fi +TIMEAUX5=$[SECONDS-TIMEAUX3] + + # Configuro la informacion del tamaño de los datos en /tmp/ogimg.info sed -i s/SIZEDATA/"$SIZEDATA"/g /tmp/ogimg.info # Creamos o redimensionamos la imagen -echo "[70] $MSG_HELP_ogCreateFileImage." | tee -a $OGLOGSESSION $OGLOGFILE +echo "[60] $MSG_HELP_ogCreateFileImage." | tee -a $OGLOGSESSION $OGLOGFILE ogCreateFileImage $3 "$5" $DIFFTYPE $SIZEREQUIRED # Esperamos que se monte la imagen despues de crarla en el servidor ogWaitMountImage "$3" "$5" "$DIFFTYPE" $SIZEREQUIRED || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $5 $DIFFTYPE: time_out." -TIMEAUX6=$[SECONDS-TIMEAUX5] -echo -e " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX6/60]m $[TIMEAUX6%60]s" | tee -a $OGLOGSESSION $OGLOGFILE -echo "[80] $MSG_HELP_ogSyncCreate" | tee -a $OGLOGSESSION $OGLOGFILE +echo "[70] $MSG_HELP_ogSyncCreate" | tee -a $OGLOGSESSION $OGLOGFILE # Copio los datos a la imagen diferecial : ogSyncCreate $1 $2 $3 "$5" $DIFFTYPE +TIMEAUX6=$[SECONDS-TIMEAUX5] +echo -e " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX6/60]m $[TIMEAUX6%60]s" | tee -a $OGLOGSESSION $OGLOGFILE # Reducimos la imagen diferencial -> solo para kernel <= 3.7, imagenes con FS ext4 echo "[80] $MSG_HELP_ogReduceImage: $3 /$4.$IMGEXT" | tee -a $OGLOGSESSION $OGLOGFILE @@ -206,23 +202,16 @@ ogReduceImage $3 "$5" $DIFFTYPE ogUnmountImage $3 "$5" $DIFFTYPE ogUnmountImage $3 "$4" $IMGEXT - -TIMEAUX7=$[SECONDS-TIMEAUX6] -echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX7/60]m $[TIMEAUX7%60]s" | tee -a $OGLOGSESSION $OGLOGFILE - - -TIMEAUX8=$[SECONDS-TIME2] -echo " $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX8/60]m $[TIMEAUX8%60]s" | tee -a $OGLOGSESSION $OGLOGFILE - +# Desbloqueo las imagenes y la particion. ogUnlockImage "$3" "/$4.$IMGEXT" ogUnlockImage "$3" "/$5.$DIFFEXT" ogUnlock $1 $2 +echo " " > $OGLOGCOMMAND # Comprobamos que la imagen esta bien echo "[95] $MSG_HELP_ogCheckSyncImage" | tee -a $OGLOGSESSION $OGLOGFILE -ogCheckSyncImage $3 "$5" diff | tee -a $OGLOGSESSION $OGLOGFILE -RETVAL=${PIPESTATUS[0]} -[ "$RETVAL" == "0" ] || ogRaiseError $OG_ERR_IMAGE "$3 $5 diff" +ogCheckSyncImage $3 "$5" diff +[ ${PIPESTATUS[0]} -eq 0 ] || ogRaiseError $OG_ERR_IMAGE "$3 $5 diff" #resumen de la operacion IMGSIZE=$(ls -l --block-size=1024 "${DIFFFILE}"| cut -f5 -d" ") diff --git a/client/shared/scripts/deployImage b/client/shared/scripts/deployImage index 30f67176..6c06b539 100755 --- a/client/shared/scripts/deployImage +++ b/client/shared/scripts/deployImage @@ -140,8 +140,6 @@ case "$REPO" in ;; esac -echo Borrar -cp $OGLOGCOMMAND.tmp $OGLOGCOMMAND.update TIME3=$SECONDS case "$NEXTOPERATION" in diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage index 18914396..9986a6c4 100755 --- a/client/shared/scripts/restoreBaseImage +++ b/client/shared/scripts/restoreBaseImage @@ -37,7 +37,8 @@ function onexit() { } # Limpiamos los archivo de log -echo -n "" >$OGLOGCOMMAND; echo -n "" $OGLOGFILE; echo -n "" $OGLOGSESSION +echo -n "" >$OGLOGCOMMAND; +[ "$(ogGetCaller)" == "RestaurarImagenBasica" -o "$(ogGetCaller)" == "restoreDiffImage" ] || echo -n "" > $OGLOGSESSION echo "[1] $MSG_SCRIPTS_START $0 $*" | tee -a $OGLOGFILE $OGLOGSESSION @@ -89,7 +90,7 @@ 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" 2>&1 | tee -a $OGLOGCOMMAND + updateCache REPO "/$2.$IMGEXT" "$PROTO" "$6" RETVAL=${PIPESTATUS[0]} if [ "$RETVAL" != "0" ] then @@ -116,7 +117,7 @@ ogMountImage "$1" "$2" "$IMGEXT" >/dev/null ogWaitMountImage "$1" "$2" "$IMGEXT" || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $IMGEXT: time_out." # Sincronizamos la partición con la imagen. echo "[60] $MSG_HELP_ogSyncRestore: $1 $2 $IMGEXT $3 $4" |tee -a $OGLOGFILE $OGLOGSESSION -ogSyncRestore "$1" "$2" "$IMGEXT" $3 $4 +ogSyncRestore "$1" "$2" "$IMGEXT" $3 $4 TIMEAUX2=$[SECONDS-TIME2] echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX2/60]m $[TIMEAUX2%60]s" | tee -a $OGLOGFILE $OGLOGSESSION @@ -127,12 +128,11 @@ ogUnmountImage "$1" "$2" "$IMGEXT" # Restableciendo acl ogUnlock $3 $4 echo "[70] $MSG_HELP_ogRestoreInfoImage" |tee -a $OGLOGFILE $OGLOGSESSION -ogRestoreInfoImage $3 $4 &>>$OGLOGCOMMAND +ogRestoreInfoImage $3 $4 # Llamar al script de post-configuración del sistema operativo. # Si a este script lo ha llamado el script restoreDiffImage no post-configuramos -ps -ef|grep -v "grep" |grep "$PPID.*restoreDiffImage " &>/dev/null || RETVAL=$? -if [ $RETVAL -ne 0 ]; then +if [ "$(ogGetCaller)" == "restoreDiffImage" ];then echo "[90] $MSG_HELP_configureOs" |tee -a $OGLOGFILE $OGLOGSESSION # el || echo es para evitar que se maneje el error. configureOs $3 $4 &>>$OGLOGCOMMAND || echo "$?" &>>$OGLOGCOMMAND diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index 028fbe46..820ee3ac 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -235,15 +235,15 @@ case "$PROTOCOLO" in # Opciones de rsync USERRSYNC="opengnsys" PASSWORD=" --password-file=/scripts/passrsync " - OPTRSYNC=" --delete " + OPTRSYNC=" --delete --progress " [ "$ogrsyncz" == "true" ] && OPTRSYNC="z $OPTRSYNC" [ "$ogrsyncw" == "true" ] && OPTRSYNC="w$OPTRSYNC" if [ -d $REPOFILE ]; then # Si es sincronizada tipo directorio. [ -d "$OGCAC$OGIMG/$2" ] || mkdir "$OGCAC$OGIMG/$2" - echo "rsync -aHAX$OPTRSYNC --quiet $USERRSYNC@$REPOIP::ogimages/$2/ $OGCAC$OGIMG/$2" |tee -a $OGLOGSESSION $OGLOGFILE - rsync -aHAX$OPTRSYNC --quiet $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$2/" "$OGCAC$OGIMG/$2" 2>&1 | tee -a $OGLOGCOMMAND + echo "rsync -aHAX$OPTRSYNC $USERRSYNC@$REPOIP::ogimages/$2/ $OGCAC$OGIMG/$2" |tee -a $OGLOGSESSION $OGLOGFILE + rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$2/" "$OGCAC$OGIMG/$2" 2>&1 | egrep "^sent|^sending|^total%" >> $OGLOGCOMMAND else # Si es sincronizada tipo archivo. [ "${2##*.}" == "img" ] && IMGTYPE="img" || IMGTYPE="diff" @@ -257,7 +257,8 @@ case "$PROTOCOLO" in # Si la imagen no existe la creo # Si la imagen del repositorio es mayor, redimensiono la imagen de cache if [ "$CACHEFILE" == "" -o $CACHEFILESIZE -lt $REALFILESIZE ]; then - ogCreateFileImage CACHE "$IMGNAME" $IMGTYPE $REALFILESIZE 2>&1 | tee -a $OGLOGCOMMAND + echo "$MSG_HELP_ogCreateFileImage" | tee -a $OGLOGSESSION $OGLOGFILE + ogCreateFileImage CACHE "$IMGNAME" $IMGTYPE $REALFILESIZE TIMEAUX3=$[SECONDS-TIMEAUX3] echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE fi @@ -266,8 +267,9 @@ case "$PROTOCOLO" in ogMountImage REPO "${IMGNAME#\/}" $IMGTYPE >/dev/null # Esperamos que se monte la imagen en el servidor ogWaitMountImage REPO "$IMGNAME" $IMGTYPE - echo -e "\n rsync -aHAX --delete --quiet $USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/ $DIRLOCAL" |tee -a $OGLOGSESSION $OGLOGFILE - rsync -aHAX$OPTRSYNC --quiet $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/" "$DIRLOCAL" 2>&1 | tee -a $OGLOGCOMMAND + echo "$MSG_HELP_ogSyncCreate" | tee -a $OGLOGSESSION $OGLOGFILE + echo "rsync -aHAX$OPTRSYNC $USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/ $DIRLOCAL" |tee -a $OGLOGSESSION $OGLOGFILE + rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/" "$DIRLOCAL" 2>&1 | egrep "^sent|^sending|^total|%" >> $OGLOGCOMMAND # RETVAL="1" -> OK RETVAL="2" -> error # valores igual que ogUpdateCacheIsNecesary [ ${PIPESTATUS[0]} == 0 ] && RETVAL="1"|| RETVAL="2" # Desmonto las imagenes |