source: client/shared/scripts/reboot @ fdd9e71

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

#726: No registrar problemas de desmontado de sistema de ficheros en los scripts poweroff y reboot.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@4730 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# Cargamos el valor por defecto del tiempo de sleep
6[ -z $OGSLEEP ] && source /opt/opengnsys/etc/engine.cfg
7
8# Si se recibe un parametro sera el tiempo de sleep antes de realizar el reboot
9if [ $# == 1 ] && [ "${1//[^0-9]/}" == "$1" ]
10then
11    TIME=$1
12    echo "[5] Se ha introducido un retardo de $TIME segundos para reiniciar"
13else
14    # Sin parámetros, o el parámetro introducido no es un número
15    TIME=${OGSLEEP:-5}
16    echo "[5] No se ha introducido un retardo, $TIME segundos para reiniciar"
17fi
18
19# No registrar errores.
20export DEBUG="no"
21
22# Desmontar los sistemas de archivos y la caché local.
23echo "[10] Desmontar todos los sistemas de archivos."
24sync
25for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do
26    ogUnmountAll $i 2>/dev/null
27done
28echo "[50] Desmontar cache local."
29ogUnmountCache 2>/dev/null
30
31# Volver a registrar errores.
32unset DEBUG
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.