source: server/bin/listclientmode @ 86d5b32

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 86d5b32 was 68ced7d, checked in by ramon <ramongomez@…>, 14 years ago

Versión 1.0.1: Adaptar script listclientmode al gestor de arranque web.

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

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#!/bin/bash
2# listclientmode: Lista la plantilla de arranque PXE para los clientes,
3#       ya sea un equipo o un aula.
4# Nota: Si no existe un enlace entre el fichero PXE con la Ethernet del equipo y su
5#        archivo plantilla, se considera que la plantilla por omisión es "default".
6# Uso:  listclienmode NombrePC | NombreAula
7# Autores: Irina Gomez y Ramon Gomez - Univ. Sevilla, noviembre 2010
8
9
10# Variables.
11PROG=$(basename $0)
12OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"}
13SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg
14PXEDIR=$OPENGNSYS/tftpboot/pxelinux.cfg
15
16# Control básico de errores.
17if [ $# -ne 1 ]; then
18        echo "$PROG: Error de ejecución"
19        echo "Formato: $PROG [NOMBRE_PC|NOMBRE_AULA]"
20        exit 1
21fi
22if [ ! -r $SERVERCONF ]; then
23        echo "$PROG: Sin acceso a fichero de configuración"
24        exit 2
25fi
26
27# Obtener datos de acceso a la Base de datos.
28source $SERVERCONF
29# Comprobar si se recibe nombre de aula o de equipo.
30IDAULA=$(mysql -u "$USUARIO" -p"$PASSWORD" -D "$CATALOG" -N -e \
31                "SELECT idaula FROM aulas WHERE nombreaula='$1';")
32
33if [ -n "$IDAULA" ]; then
34        # Aula encontrada
35        PCNAME=$(mysql -u "$USUARIO" -p"$PASSWORD" -D "$CATALOG" -N -e \
36                "SELECT nombreordenador FROM ordenadores WHERE idaula='$IDAULA';")
37else
38        # Buscar ordenador
39        PCNAME=$(mysql -u "$USUARIO" -p"$PASSWORD" -D "$CATALOG" -N -e \
40                "SELECT nombreordenador FROM ordenadores WHERE nombreordenador='$1';")
41fi
42if [ -z "$PCNAME" ]; then
43        echo "$PROG: No existe ningún aula o equipo con el nombre \"$1\""
44        exit 1
45fi
46
47for PC in $PCNAME; do
48        PXE=$(mysql -u "$USUARIO" -p"$PASSWORD" -D "$CATALOG" -N -e \
49                "SELECT arranque FROM ordenadores WHERE nombreordenador='$PC';")
50        echo "Equipo $PC asociado a arranque tipo \"$PXE\""
51done
52
Note: See TracBrowser for help on using the repository browser.