diff options
author | irina <irinagomez@us.es> | 2015-12-15 10:17:59 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2015-12-15 10:17:59 +0000 |
commit | dc157aebd8235ffac8fa7075d33bc143ef489714 (patch) | |
tree | ed77eb706bd599f27923bb14a158dc0e083e0615 /client/shared | |
parent | 79a417549b502d8383e1fa66702077d374df570e (diff) |
#678 Unidades organizativas separadas: script de restauraciĆ³n
git-svn-id: https://opengnsys.es/svn/branches/version1.1@4755 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/shared')
-rwxr-xr-x | client/shared/scripts/restoreImage | 7 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 15 |
2 files changed, 14 insertions, 8 deletions
diff --git a/client/shared/scripts/restoreImage b/client/shared/scripts/restoreImage index f0bda76a..0f5317df 100755 --- a/client/shared/scripts/restoreImage +++ b/client/shared/scripts/restoreImage @@ -45,13 +45,16 @@ PROTO=${PROTO:-"UNICAST"} PROTOOPT="$6" IMGTYPE="${IMGTYPE:-"img"}" +# Unidad organizativa +[ "$ogunit" != "" ] && OGUNIT="$ogunit/" + # Si es una ip y es igual a la del equipo restaura desde cache [ "$REPO" == "$(ogGetIpAddress)" ] && REPO="CACHE" # Si es una ip y es distinta a la del recurso samba cambiamos de REPO. ogCheckIpAddress $REPO if [ $? == 0 -o $REPO == "REPO" ] ; then # Si falla el cambio -> salimos con error repositorio no valido - ogChangeRepo $REPO || exit $(ogRaiseError $OG_ERR_NOTFOUND '$REPO'; echo $?) + ogChangeRepo $REPO ${OGUNIT%/} || exit $(ogRaiseError $OG_ERR_NOTFOUND '$REPO $OGUNIT'; echo $?) REPO="REPO" fi @@ -77,7 +80,7 @@ case "$PROTO" in COMPRESS=$(ogGetImageCompressor REPO $IMGNAME) #TODO comprobar parametros anteriores ogEcho log session "[40] ogMcastReceiverPartition $DISK $PART $PORT $TOOL $COMPRESS" - ogMcastRequest "$IMGNAME.img" "$PROTOOPT" + ogMcastRequest "$OGUNIT$IMGNAME.img" "$PROTOOPT" ogExecAndLog command ogMcastReceiverPartition "$DISK" "$PART" "$PORT" "$TOOL" "$COMPRESS" RETVAL=$? ;; diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index 03cc4234..e7e1dfe8 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -49,11 +49,14 @@ echo " " > $OGLOGCOMMAND REPOSITORIO="${1^^}" PROTOCOLO="${3^^}" OPTPROTOCOLO="$4" +# Unidad organizativa. +[ "$ogunit" != "" ] && OGUNIT="$ogunit/" + # Si es una ip y es distinta a la del recurso samba cambiamos de REPO. ogCheckIpAddress $REPOSITORIO if [ $? == 0 -o $REPOSITORIO == "REPO" ] ; then # Si falla el cambio -> salimos con error repositorio no valido - ogChangeRepo $REPOSITORIO || exit $(ogRaiseError $OG_ERR_NOTFOUND $REPOSITORIO; echo $?) + ogChangeRepo $REPOSITORIO $OGUNIT || exit $(ogRaiseError $OG_ERR_NOTFOUND $REPOSITORIO; echo $?) REPOSITORIO="REPO" fi REPOIP=$(ogGetRepoIp) @@ -215,15 +218,15 @@ case "$PROTOCOLO" in else # TODO ticket 379 Realizar la peticiĆ³n basada en identificador de operacion - ogEcho log session "$MSG_SCRIPTS_TASK_START : hose $REPOIP 2009 --out sh -c \"echo -ne START_MULTICAST $2 $OPTPROTOCOLO\"" - hose $REPOIP 2009 --out sh -c "echo -ne START_MULTICAST $2 $OPTPROTOCOLO" + ogEcho log session "$MSG_SCRIPTS_TASK_START : hose $REPOIP 2009 --out sh -c \"echo -ne START_MULTICAST $OGUNIT$2 $OPTPROTOCOLO\"" + hose $REPOIP 2009 --out sh -c "echo -ne START_MULTICAST $OGUNIT$2 $OPTPROTOCOLO" #echo "espero y llamo a: ogMcastReceiverFile $PORT CACHE $2" sleep 10 if (nmap -n -sU -p $PORTAUX $REPOIP | grep open) then ogExecAndLog command ogMcastReceiverFile $PORT CACHE "$2" else - ogEcho log session "$MSG_SCRIPTS_TASK_ERR : hose $REPOIP 2009 --out sh -c echo -ne START_MULTICAST $2 $OPTPROTOCOLO" + ogEcho log session "$MSG_SCRIPTS_TASK_ERR : hose $REPOIP 2009 --out sh -c echo -ne START_MULTICAST $OGUNIT$2 $OPTPROTOCOLO" exit $OG_ERR_UPDATECACHE fi fi @@ -251,8 +254,8 @@ case "$PROTOCOLO" in if [ -d $REPOFILE ]; then # Si es sincronizada tipo directorio. [ -d "$OGCAC$OGIMG/$2" ] || mkdir "$OGCAC$OGIMG/$2" - ogEcho log session "rsync -aHAX$OPTRSYNC $USERRSYNC@$REPOIP::ogimages/$2/ $OGCAC$OGIMG/$2" - rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$2/" "$OGCAC$OGIMG/$2" 2>> $OGLOGCOMMAND | egrep "^sent|^sending|^total%" >> $OGLOGCOMMAND + ogEcho log session "rsync -aHAX$OPTRSYNC $USERRSYNC@$REPOIP::ogimages/$OGUNIT$2/ $OGCAC$OGIMG/$2" + rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$OGUNIT$2/" "$OGCAC$OGIMG/$2" 2>> $OGLOGCOMMAND | egrep "^sent|^sending|^total%" >> $OGLOGCOMMAND else # Si es sincronizada tipo archivo. [ "${2##*.}" == "img" ] && IMGTYPE="img" || IMGTYPE="diff" |