source: repoman/bin/deletepreimage @ e1ddc83

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since e1ddc83 was 7bc0d79, checked in by albertogp <albertogp@…>, 11 years ago

añadiendo permisos de ejecucion en fichero deletepreimage

git-svn-id: https://opengnsys.es/svn/branches/version1.0@4071 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/bin/bash
2# Eliminar las imagenees del repositiro seg�raca de la consola web .img
3#Version 0.3   Ejecuci�n desde cron cada minuto.
4#echo "* * * * *   root   /opt/opengnsys/bin/image-delete" > /etc/cron.d/imagedelete
5
6# Comprobar si el proceso ya est� en ejecuci�n.on.
7PROG=$(basename $0)
8[ "$(pgrep "$PROG")" != "$$" ] && exit
9
10# Variables.
11OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"}
12PATH=$PATH:$OPENGNSYS/bin
13OGIMG="$OPENGNSYS/images"
14REPOCFG="$OPENGNSYS/etc/ogAdmRepo.cfg"
15LOGFILE="$OPENGNSYS/log/$PROG.log"
16
17# Error si no est� bien configurado el repositorio de im�genes.nes.
18[ -d $OGIMG -a -f $REPOCFG ] || exit 1
19
20# Procesar ficheros de im�genes.s.
21trap 'echo "`date` : Proceso interrumpido" >> $LOGFILE; exit ' 1 2 3 6 9 15
22
23#TODO en LOCAL: si existe algun fichero *.delete lo movemos al repositorio
24ls /opt/opengnsys/www/tmp/*.delete &>/dev/null || exit
25#[ -f /opt/opengnsys/www/tmp/*.delete ] &&
26mv /opt/opengnsys/www/tmp/*.* /opt/opengnsys/images/
27
28#TODO: iniciar blucle siempre y cuando haya algun delete
29ls /opt/opengnsys/images/*.delete &>/dev/null || exit
30
31for IMG in `ls /opt/opengnsys/images/*.delete`; do
32        DELETEIMAGE=$(echo $IMG | awk -F"." '{print $1}' | awk -F"/opt/opengnsys/images/" '{print $2}')
33        # Borramos marca .delete para que el proximo cron no trabaje sobre este conjunto.
34        [ -f  $IMG ] &&  rm $IMG
35        ## se llama al escript de borrado de imagen.
36        /opt/opengnsys/bin/deleteimage $DELETEIMAGE
37done
Note: See TracBrowser for help on using the repository browser.