#493 Configurar el arranque PXE desde el cliente

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3719 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/debian-pkg
Irina Gomez 2013-03-27 16:33:02 +00:00
parent d2b8d242b5
commit 831830f0a0
3 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,41 @@
#!/bin/bash
# Script para solicitar acciones al servidor de administración desde los clientes.
# Acciones permitidas: configurar modo de arranque.
PARM=`cat`
BASEDIR=/opt/opengnsys
PATH=$PATH:$BASEDIR/bin
SERVERNAME=ogAdmServer
SERVERLOG=$BASEDIR/log/$SERVERNAME.log
# Añade registro de incidencias.
function echolog () {
date +"%Y%m%d-%H%M%S $*" >> $SERVERLOG
}
PARM1=$(echo $PARM | cut -f1 -d" ")
PARM2=$(echo $PARM | cut -f2 -d" ")
PARM3=$(echo $PARM | cut -f3 -d" ")
PARM4=$(echo $PARM | cut -f4 -d" ")
case "$PARM1" in
SET_CLIENTMODE)
#1 SET_CLIENTMODE
#2 template
#3 pc_name o group_pc
TEMPLATE="$PARM2"
PC="$PARM3"
echolog "Ejecutar $(which setclientmode) $FILE $MCASTOPT"
setclientmode $TEMPLATE $PC &>> $SERVERLOG
exit $?
;;
default)
echolog "Solicitud con parametros \"$PARM\" no realizada, no registrada o con errores"
;;
esac

View File

@ -40,6 +40,11 @@ REPOAUXNAME=ogAdmRepoAux
REPOAUXDAEMON=$BASEDIR/sbin/$REPOAUXNAME
REPOAUXPORT=$(awk -F= '/PUERTO/ {print $2+1}' $SERVERCFG 2>/dev/null)
############## ADV
############# IRINA # para setBootMode desde el cliente
SERVERAUXNAME=ogAdmServerAux
SERVERAUXDAEMON=$BASEDIR/sbin/$SERVERAUXNAME
SERVERAUXPORT=2011
############# IRINA
#
# Servidor de tareas programadas
@ -139,6 +144,10 @@ arranca_demonios() {
$ACTIONMSG "Iniciando demonio: $SERVERNAME"
$DAEMONSTART $SERVERDAEMON $EXTRAOPTS $SERVERDAEMON_OPTIONS $ENDOPTS
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
# Para SetBootmode desde el cliente
$ACTIONMSG "Iniciando demonio: $SERVERAUXNAME" #
faucet $SERVERAUXPORT --daemon --in bash -c "$SERVERAUXDAEMON" # NUEVO
[ $? = 0 ] && $SUCCESSMSG || $FAILMSG
fi
if [ $RUN_OGADMSERVER = "yes" ] && [ $RUN_OGADMREPO = "yes" ]; then
sleep 5 # Damos tiempo a que ogAdmServer este funcionando

View File

@ -0,0 +1,34 @@
#!/bin/bash
# #/**
# setBootMode
#@brief Script to configure the PXE mode to client
#@param 1 template
#@date 2012-02-2-9
#*/ ##
REPOIP="$(ogGetRepoIp)"
PORT=2011
TEMPLATE="/opt/oglive/tftpboot/menu.lst/templates/$1"
PCNAME="$(hostname)"
if [ "$*" == "help" ]; then
ogHelp "$PROG" "$PROG template" \
"$PROG pxe" \
"$PROG 01"
exit
fi
# Control básico de errores.
if [ $# -ne 1 ]; then
ogRaiseError $OG_ERR_FORMAT "$MSG_ERR_FORMAT: $PROG TEMPLATE_NAME"
exit $?
fi
if [ ! -e $TEMPLATE ]; then
ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_NOTFOUND: $TEMPLATE"
exit $?
fi
hose $REPOIP $PORT --out sh -c "echo -ne SET_CLIENTMODE $1 $PCNAME"