#! /bin/sh # # halt Execute the halt command. # # Basado en la versión del 19-Jun-2004 miquels@cistron.nl # PATH=/sbin:/bin:/usr/sbin:/usr/bin # Lee las variables desde el archivo de variables [ -f /etc/default/halt ] && . /etc/default/halt # Según los parámetros ejecuta if [ "$INIT_HALT" = "" ] then case "$HALT" in [Pp]*) INIT_HALT=POWEROFF ;; [Hh]*) INIT_HALT=HALT ;; *) INIT_HALT=POWEROFF ;; esac fi # Si hay que ejecutar un control de UPS (Sistema SAI) if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ] then /etc/init.d/ups-monitor poweroff fi # Si hay un sistema RAID lo gestiona hddown="-h" if grep -qs '^md.*active' /proc/mdstat then hddown="" fi # If INIT_HALT=HALT don't poweroff. poweroff="-p" if [ "$INIT_HALT" = "HALT" ] then poweroff="" fi halt -d -f -i $poweroff $hddown : exit 0