diff options
author | albertogp <albertogp@uma.es> | 2013-07-23 09:38:00 +0000 |
---|---|---|
committer | albertogp <albertogp@uma.es> | 2013-07-23 09:38:00 +0000 |
commit | 8bf033d9f6514b90e695ef4e2c3f1eac09b479a0 (patch) | |
tree | 291bb03c7fdf34bd9dce40977745730440f8cae7 /repoman/bin/deletepreimage | |
parent | c6c051669ca9d2c57d3ae13a956247ea3ded2a50 (diff) |
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4023 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'repoman/bin/deletepreimage')
-rw-r--r-- | repoman/bin/deletepreimage | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/repoman/bin/deletepreimage b/repoman/bin/deletepreimage new file mode 100644 index 00000000..7fe4b178 --- /dev/null +++ b/repoman/bin/deletepreimage @@ -0,0 +1,37 @@ +#!/bin/bash +# Eliminar las imagenees del repositiro seg�raca de la onsola web .img +#Version 0.3 Ejecuci�n desde cron cada minuto,o. +#echo "* * * * * root /opt/opengnsys/bin/image-delete" > /etc/cron.d/imagedelete + +# Comprobar si el proceso ya est� en ejecuci�n.on. +PROG=$(basename $0) +[ "$(pgrep "$PROG")" != "$$" ] && exit + +# Variables. +OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} +PATH=$PATH:$OPENGNSYS/bin +OGIMG="$OPENGNSYS/images" +REPOCFG="$OPENGNSYS/etc/ogAdmRepo.cfg" +LOGFILE="$OPENGNSYS/log/$PROG.log" + +# Error si no est� bien configurado el repositorio de im�genes.nes. +[ -d $OGIMG -a -f $REPOCFG ] || exit 1 + +# Procesar ficheros de im�genes.s. +trap 'echo "`date` : Proceso interrumpido" >> $LOGFILE; exit ' 1 2 3 6 9 15 + +#TODO en LOCAL: si existe algun fichero *.delete lo movemos al repositorio +ls /opt/opengnsys/www/tmp/*.delete &>/dev/null || exit +#[ -f /opt/opengnsys/www/tmp/*.delete ] && +mv /opt/opengnsys/www/tmp/*.* /opt/opengnsys/images/ + +#TODO: iniciar blucle siempre y cuando haya algun delete +ls /opt/opengnsys/images/*.delete &>/dev/null || exit + +for IMG in `ls /opt/opengnsys/images/*.delete`; do + DELETEIMAGE=$(echo $IMG | awk -F"." '{print $1}' | awk -F"/opt/opengnsys/images/" '{print $2}') + # Borramos marca .delete para que el proximo cron no trabaje sobre este conjunto. + [ -f $IMG ] && rm $IMG + ## se llama al escript de borrado de imagen. + /opt/opengnsys/bin/deleteimage $DELETEIMAGE +done
\ No newline at end of file |