close
Warning:
Failed to sync with repository "ogBrowser-Git": (1366, "Incorrect string value: '\\xF0\\x9F\\x93\\xA6 I...' for column 'message' at row 1"); repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
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
| 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 |
|---|
| 9 | if [ $# == 1 ] && [ "${1//[^0-9]/}" == "$1" ] |
|---|
| 10 | then |
|---|
| 11 | TIME=$1 |
|---|
| 12 | echo "[5] Se ha introducido un retardo de $TIME segundos para reiniciar" |
|---|
| 13 | else |
|---|
| 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" |
|---|
| 17 | fi |
|---|
| 18 | |
|---|
| 19 | # Desmontar los sistemas de archivos y la caché local. |
|---|
| 20 | echo "[10] Desmontar todos los sistemas de archivos." |
|---|
| 21 | sync |
|---|
| 22 | for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do |
|---|
| 23 | ogUnmountAll $i 2>/dev/null |
|---|
| 24 | done |
|---|
| 25 | echo "[50] Desmontar cache local." |
|---|
| 26 | ogUnmountCache 2>/dev/null |
|---|
| 27 | echo "[90] Reiniciar el equipo." |
|---|
| 28 | # Estado correcto de Wake-On-Lan antes de reiniciar. |
|---|
| 29 | ethtool -s $DEVICE wol g 2>/dev/null |
|---|
| 30 | # Detectar Busybox. |
|---|
| 31 | BUSYBOX=$(which busyboxOLD) |
|---|
| 32 | BUSYBOX=${BUSYBOX:-"busybox"} |
|---|
| 33 | |
|---|
| 34 | # Retardo para dar lugar al registro en cola de acciones. |
|---|
| 35 | sleep $TIME |
|---|
| 36 | # Parar Browser para evitar "cuelgues". |
|---|
| 37 | pkill browser |
|---|
| 38 | # Reiniciar. |
|---|
| 39 | $BUSYBOX reboot |
|---|
| 40 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.