source: server/bin/listclientlive @ b7bed1c

918-git-images-111dconfigure-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-instalacion
Last change on this file since b7bed1c was da6986dc, checked in by Ramón M. Gómez <ramongomez@…>, 5 years ago

#957: Script listclientlive uses common server functions.

  • Property mode set to 100755
File size: 1.3 KB
RevLine 
[5d28f39]1#!/bin/bash
[da6986dc]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
[5d28f39]10
11
12# Variables.
13OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"}
14SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg
15TFTPDIR=$OPENGNSYS/tftpboot
[da6986dc]16
17source $OPENGNSYS/lib/ogfunctions.sh || exit 1
[5d28f39]18
19# Control básico de errores.
[da6986dc]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"
[5d28f39]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.
[da6986dc]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';"
[5d28f39]35
Note: See TracBrowser for help on using the repository browser.