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
Rev | Line | |
---|
[36a4dfd] | 1 | #!/bin/bash |
---|
| 2 | # Scirpt de ejemplo para apagar un ordenador |
---|
| 3 | # (puede usarse como base para el programa de apagado usado por OpenGNSys Admin). |
---|
| 4 | |
---|
| 5 | |
---|
[02a1b0e] | 6 | # Registrar ejecución manual de script. |
---|
| 7 | case "$(ogGetCaller)" in |
---|
| 8 | browser|bash) ogEcho log info "Script: $0" ;; |
---|
| 9 | esac |
---|
| 10 | |
---|
[30afd953] | 11 | # No registrar errores. |
---|
| 12 | export DEBUG="no" |
---|
| 13 | |
---|
[14ed3c9] | 14 | # Desmontar los sistemas de archivos y la caché local. |
---|
[36a4dfd] | 15 | echo "[10] Desmontar todos los sistemas de archivos." |
---|
| 16 | sync |
---|
| 17 | for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do |
---|
[02a1b0e] | 18 | ogUnmountAll $i &>/dev/null |
---|
[36a4dfd] | 19 | done |
---|
| 20 | echo "[50] Desmontar cache local." |
---|
[02a1b0e] | 21 | ogUnmountCache &>/dev/null |
---|
[fdd9e71] | 22 | |
---|
[30afd953] | 23 | # Volver a registrar errores. |
---|
| 24 | unset DEBUG |
---|
| 25 | |
---|
[062b55a] | 26 | echo "[70] Apagando el equipo." |
---|
[14ed3c9] | 27 | # Estado correcto de Wake-On-Lan antes de apagar. |
---|
| 28 | ethtool -s $DEVICE wol g 2>/dev/null |
---|
| 29 | # Detectar Busybox. |
---|
| 30 | BUSYBOX=$(which busyboxOLD) |
---|
| 31 | BUSYBOX=${BUSYBOX:-"busybox"} |
---|
[27aa561] | 32 | |
---|
| 33 | # Retardo para dar lugar al registro en cola de acciones. |
---|
| 34 | sleep 5 |
---|
[d368c7b] | 35 | # Parar Browser para evitar "cuelgues". |
---|
[1a2fa9d8] | 36 | [ "$ogstatus" == "offline" ] || pkill browser |
---|
[27aa561] | 37 | # Apagar. |
---|
| 38 | $BUSYBOX poweroff |
---|
[36a4dfd] | 39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.