source: client/shared/scripts/reboot @ 7bb2f3f

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

#726: Incluir variable NODEBUGFUNCTIONS en fichero engine.cfg con la lista de funciones que no muestran errores ni avisos si son llamadas desde scripts y funciones; modificar función ogRaiseError para aplicar este cambio; revertir modificaciones que ya no son necesarios en algunos scripts.

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

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/bin/bash
2# Script de ejemplo para reiniciar un ordenador
3# (puede usarse como base para el programa de reinicio usado por OpenGNSys Admin).
4
5
6# Registrar ejecución manual de script.
7case "$(ogGetCaller)" in
8    browser|bash)  ogEcho log info "Script: $0" ;;
9esac
10
11# Cargamos el valor por defecto del tiempo de sleep
12[ -z $OGSLEEP ] && source /opt/opengnsys/etc/engine.cfg
13
14# Si se recibe un parametro sera el tiempo de sleep antes de realizar el reboot
15if [ $# == 1 ] && [ "${1//[^0-9]/}" == "$1" ]
16then
17    TIME=$1
18    echo "[5] Se ha introducido un retardo de $TIME segundos para reiniciar"
19else
20    # Sin parámetros, o el parámetro introducido no es un número
21    TIME=${OGSLEEP:-5}
22    echo "[5] No se ha introducido un retardo, $TIME segundos para reiniciar"
23fi
24
25# Desmontar los sistemas de archivos y la caché local.
26echo "[10] Desmontar todos los sistemas de archivos."
27sync
28for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do
29    ogUnmountAll $i &>/dev/null
30done
31echo "[50] Desmontar cache local."
32ogUnmountCache &>/dev/null
33
34echo "[90] Reiniciar el equipo."
35# Estado correcto de Wake-On-Lan antes de reiniciar.
36ethtool -s $DEVICE wol g 2>/dev/null
37# Detectar Busybox.
38BUSYBOX=$(which busyboxOLD)
39BUSYBOX=${BUSYBOX:-"busybox"}
40
41# Retardo para dar lugar al registro en cola de acciones.
42sleep $TIME
43# Parar Browser para evitar "cuelgues".
44[ "$ogstatus" == "offline" ] || pkill browser
45# Reiniciar.
46$BUSYBOX reboot
47
48
Note: See TracBrowser for help on using the repository browser.