configure-oglivelgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change
on this file since 915580e was
828277b,
checked in by Ramón M. Gómez <ramongomez@…>, 5 years ago
|
#983: Avoid error messages in some Cron scripts.
|
-
Property mode set to
100755
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # Eliminar las imágenees del repositiro seg�raca de la consola web. |
---|
3 | #Version 0.3 Ejecución desde cron cada minuto. |
---|
4 | #echo "* * * * * root /opt/opengnsys/bin/image-delete" > /etc/cron.d/imagedelete |
---|
5 | # Version 1.1.0 - Llamar a script "checkrepo". |
---|
6 | |
---|
7 | # Comprobar si el proceso ya está en ejecución. |
---|
8 | PROG=$(basename $0) |
---|
9 | [ "$(pgrep "$PROG")" != "$$" ] && exit |
---|
10 | |
---|
11 | # Variables. |
---|
12 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} |
---|
13 | PATH=$PATH:$OPENGNSYS/bin |
---|
14 | OGIMG="$OPENGNSYS/images" |
---|
15 | REPOCFG="$OPENGNSYS/etc/ogAdmRepo.cfg" |
---|
16 | LOGFILE="$OPENGNSYS/log/$PROG.log" |
---|
17 | |
---|
18 | # Error si no está bien configurado el repositorio de imágenes. |
---|
19 | [ -d $OGIMG -a -f $REPOCFG ] || exit 1 |
---|
20 | |
---|
21 | # Procesar ficheros de imágenes. |
---|
22 | trap 'echo "`date` : Proceso interrumpido" >> $LOGFILE; exit ' 1 2 3 6 9 15 |
---|
23 | |
---|
24 | shopt -s nullglob |
---|
25 | TODELETE=( $OPENGNSYS/www/tmp/*.delete ) |
---|
26 | |
---|
27 | for IMG in ${TODELETE[@]##*/}; do |
---|
28 | # Obtenemos el nombre de la imagen |
---|
29 | DELETEIMAGE="${IMG%%.*}" |
---|
30 | ## Si la imagen es un backup se añade la extensión ant |
---|
31 | [ "${IMG##*.}" == "ant" ] && DELETEIMAGE+=".ant" |
---|
32 | |
---|
33 | ## si directorio:imagen cambiamos : por / |
---|
34 | DELETEIMAGE=$(echo $DELETEIMAGE|tr : /) |
---|
35 | |
---|
36 | ## se llama al escript de borrado de imagen. |
---|
37 | deleteimage $DELETEIMAGE |
---|
38 | done |
---|
39 | |
---|
40 | # Eliminar marcas de borrado. |
---|
41 | rm -f ${TODELETE[@]} |
---|
42 | # Actualizar información del repositorio. |
---|
43 | checkrepo |
---|
44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.