source: server/bin/listclientlive @ b7bed1c

918-git-images-111dID-1020_logrotateBugID-1037_Mostrar.TipoDisco.WebID-1038_Muestra.el.numero.de.ordenadoresID-1039_Asignar_Disco.Particion.Imagen.AccesoRemotoID-824_Iniciar.Sistema.Restauradodevel-ogadmserver-for-masterdisk-imagemainmaster-1037opengnsys-1.1.1dpreqndtest
Last change on this file since b7bed1c was da6986dc, checked in by Ramón M. Gómez <ramongomez@…>, 4 years ago

#957: Script listclientlive uses common server functions.

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/bash
2#/**
3#@file    listclientlive
4#@brief   Lista la distribución ogLive asociada a los clientes, ya sea un equipo o un aula.
5#@usage   listclienlive Ambito
6#@param   Ambito     nombre de ordenador o nombre de aula
7#@version 1.1.0 - Versión inicial basada en el script "listclientmode"
8#@author  Ramón M. Gómez, ETSII Universidad de Sevilla
9#@date    2017-06-01
10
11
12# Variables.
13OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"}
14SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg
15TFTPDIR=$OPENGNSYS/tftpboot
16
17source $OPENGNSYS/lib/ogfunctions.sh || exit 1
18
19# Control básico de errores.
20[ "$*" == "help" ] && help
21[ "$*" == "version" ] && version
22[ $# -eq 1 ] || raiseError usage
23[ "$USER" != "root" ] && raiseError access "Need to be root"
24source $SERVERCONF 2>/dev/null || raiseError access "Sin acceso a fichero de configuración"
25
26# Sustituir caracteres ' por \' para evitar inyección SQL.
27RESOURCE="${1//\'/\'}"
28# Obtener nombre de ordenador individual o todos los de una aula e indicar su plantilla asociada.
29dbexec "SELECT CONCAT_WS('', 'Equipo \"', ord.nombreordenador, '\" asociado a cliente \"',
30               ord.oglivedir, '\"  $([ -e $TFTPDIR/$OGLIVE ] || echo "(inexistente)")')
31          FROM ordenadores AS ord
32          JOIN aulas USING (idaula)
33         WHERE aulas.nombreaula='$RESOURCE'
34            OR ord.nombreordenador='$RESOURCE';"
35
Note: See TracBrowser for help on using the repository browser.