source: client/nfsexport/scripts/initCache @ f4b737d

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 f4b737d was e1c4317, checked in by ramon <ramongomez@…>, 15 years ago

Corrección pequeño fallo en script initCache.

git-svn-id: https://opengnsys.es/svn/trunk@901 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/bash
2# Scirpt de iniciación de la caché local de disco.
3# (puede usarse como base para el programa de restauración de imágenes usado por OpenGnSys Admin).
4# Versión: 0.91, 2009/03/17, - Ramón Gómez, Universidad de Sevilla
5
6TIME1=$SECONDS
7PROG="$(basename $0)"
8if [ $# -ne 1 ]; then
9    ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG tamaño"
10    exit $?
11fi
12
13# Si tamaño=0, borrar caché.
14if [ $1 == 0 ]; then
15    echo "[10] Trabajar sin caché local."
16    ogUnmountCache 2>/dev/null
17    ogDeleteCache
18else
19    # Si no existe caché o si cambia su tamaño, crearla.
20    SIZE=$(ogGetCacheSize 2>/dev/null)
21    if [ "$1" != "$SIZE" ]; then
22        echo "[10] Crar partición de caché local."
23        ogUnmountCache 2>/dev/null
24        ogCreateCache "$1"
25    fi
26    # Si caché no montada y no formateada, formatear.
27    CACHE=$(ogFindCache) || exit $?
28    if ! ogIsFormated $CACHE; then
29        echo "[50] Formatear caché local."
30        ogFormatCache
31    fi
32    echo "[70] Montar caché local."
33    ogMountCache 2>/dev/null
34    # Si error al montar, chequear sistema de archivos y volver a montar.
35    if [ $? != 0 ]; then
36        echo "[80] Comprobar y montar caché local."
37        ogCheckFs $CACHE
38        ogMountCache || exit $?
39    fi
40fi
41# Duración del proceso.
42TIME=$[SECONDS-TIME1]
43echo "[100] Duración de la operación $[TIME/60]m $[TIME%60]s"
44
Note: See TracBrowser for help on using the repository browser.