Shutdown.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
(M) |
|||
| Zeile 108: | Zeile 108: | ||
}} | }} | ||
| − | ==Ergänzung für {{wikipedia|LILO}}== | + | ==[[NVRAM WakeUp]]== |
| + | shell> cd /tmp | ||
| + | shell> cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nvram-wakeup login | ||
| + | shell> cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nvram-wakeup co nvram-wakeup/reboot | ||
| + | |||
| + | Hier sollte sich ein passender Reboot-Kernel finden. | ||
| + | |||
| + | shell> KERNEL_VERSION=`uname -r` | ||
| + | shell> find $PWD -name "bzImage.${KERNEL_VERSION:0:3}*" -exec cp -v {} /boot/bzImage.poweroff \; | ||
| + | |||
| + | ===Ergänzung für {{wikipedia|LILO}}=== | ||
{{Box Datei | /etc/lilo.conf | | {{Box Datei | /etc/lilo.conf | | ||
<pre> | <pre> | ||
| Zeile 118: | Zeile 128: | ||
}} | }} | ||
| − | ==Ergänzung für {{wikipedia|GRUB}}== | + | ===Ergänzung für {{wikipedia|GRUB}}=== |
{{Box Datei | /boot/grub/menu.lst | | {{Box Datei | /boot/grub/menu.lst | | ||
<pre> | <pre> | ||
Version vom 22. April 2006, 00:15 Uhr
Vorschlag für ein einfaches Shutdown-Skript.
$PATH/shutdown.sh
#!/bin/bash
#
# shutdown.sh
# wake up method ('off','acpi','nvram','suspend')
WAKEUP_METHOD="off"
# read board configuration from specified configuration file (e.g: "/etc/nvram-wakeup.conf")
NVRAM_CONFIG=""
# specify the iw (infowriter) name. (e.g: gigabyte_5aa)
NVRAM_IWNAME=""
# try "nvram-wakeup --help"
NVRAM_OPT="--syslog"
# Which boot manager are you using? (grub/lilo)
BOOT_MANAGER="grub"
TIMER=$1
LILOCNF=/etc/lilo.conf
GRUBCNF=/boot/grub/menu.lst
ACPIALARM=/proc/acpi/alarm
case ${#TIMER}-${WAKEUP_METHOD:-off} in
10-acpi)
test -e $ACPIALARM
case $? in
0) date -d "1970-01-01 UTC $((TIMER-120)) seconds" +"%Y-%m-%d %R:%S" > $ACPIALARM
sudo poweroff
exit 0
;;
*) logger -t ${0##*/} "ARG -> missing $ACPIALARM"
;;
esac
;;
10-nvram)
test -e /dev/nvram -a -e /dev/rtc -a -e /dev/mem
case $? in
0) which nvram-wakeup >/dev/null 2>&1
case $? in
0) IWNAME="${NVRAM_IWNAME/*[unknown, ]*}"
sudo nvram-wakeup -s $TIMER $NVRAM_OPT ${NVRAM_CONFIG:+-C $NVRAM_CONFIG} ${IWNAME:+-I $IWNAME}
case ${BOOT_MANAGER:-lilo} in
grub) REBOOT_LINE=`grep -s ^title "$GRUBCNF" | grep -i -n poweroff | { IFS=: read a b ; echo $a ; }`
test -n "$REBOOT_LINE"
case $? in
0) which grub-set-default >/dev/null 2>&1
case $? in
0) sudo grub-set-default $((REBOOT_LINE-1))
;;
*) echo -e "savedefault --default=$((REBOOT_LINE-1)) --once\nquit" | sudo grub --batch
;;
esac
;;
*) logger -t ${0##*/} "ARG -> missing poweroff entry in $GRUBCNF"
;;
esac
;;
lilo) REBOOT_ENTRY=`grep -s -i label.*poweroff "$LILOCNF" | { IFS== read a b ; echo $b ; }`
test -n "$REBOOT_ENTRY"
case $? in
0) sudo lilo -R $REBOOT_ENTRY
;;
*) logger -t ${0##*/} "ARG -> missing poweroff entry in $LILOCNF"
;;
esac
;;
esac
sudo shutdown -r now
exit 0
;;
*) logger -t ${0##*/} "ARG -> missing nvram-wakeup"
;;
esac
;;
*) logger -t ${0##*/} "ARG -> missing /dev/nvram -o /dev/rtc -o /dev/mem"
;;
esac
;;
10-suspend)
test -e $ACPIALARM -a -e /sys/power/state
case $? in
0) date -d "1970-01-01 UTC $((TIMER-30)) seconds" +"%Y-%m-%d %R:%S" > $ACPIALARM
echo mem > /sys/power/state
sudo reboot
exit 0
;;
*) logger -t ${0##*/} "ARG -> missing $ACPIALARM -o /sys/power/state"
;;
esac
;;
10-off)
logger -t ${0##*/} "MESG -> no wakeup method"
;;
1-*)
logger -t ${0##*/} "MESG -> no timer"
;;
esac
sudo shutdown -h now
exit $?
NVRAM WakeUp
shell> cd /tmp shell> cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nvram-wakeup login shell> cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nvram-wakeup co nvram-wakeup/reboot
Hier sollte sich ein passender Reboot-Kernel finden.
shell> KERNEL_VERSION=`uname -r`
shell> find $PWD -name "bzImage.${KERNEL_VERSION:0:3}*" -exec cp -v {} /boot/bzImage.poweroff \;
Ergänzung für LILO