source: client/nfsexport/scripts/initCache @ e6c0037

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

Script para iniciar la caché del cliente.

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

  • Property mode set to 100755
File size: 1.4 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" || return $?
25    fi
26    # Si caché no montada y no formateada, formatear.
27    CACHE=$(ogFindCache) || return $?
28    #if ogIsFormated $CACHE; then              # API 1.0
29    if ! ogIsMounted $CACHE && [ "$(ogGetFsType $CACHE)" != "CACHE" ]; then
30        echo "[50] Formatear caché local."
31        ogFormatCache
32    fi
33    echo "[70] Montar caché local."
34    ogMountCache
35    # Si error al montar, chequear sistema de archivos y volver a montar.
36    if [ $? != 0 ]; then
37        echo "[80] Comprobar y montar caché local."
38        ogCheckFs $CACHE
39        ogMountCache || return $?
40    fi
41fi
42# Duración del proceso.
43TIME=$[SECONDS-TIME1]
44echo "[100] Duración de la operación $[TIME/60]m $[TIME%60]s"
45
Note: See TracBrowser for help on using the repository browser.