Go to content

geek_stuff/server & linux

ACPI Wakeup in Linux

 

 

ChangeRTCAlarm()
{
 # Caution !!
 # System should set to be turned on by RTCAlarm at 00:01:00 01/01/2008
# echo "Current Date"
# date
# echo ""
# echo "Changed to"
# date 010100002008
# echo 2008-01-01 00:01:00 > /proc/acpi/alarm

 CUR_DATE=`date +%F`
 NEW_TIME=`date --date "now + 1 minute" +%T`
 OLD_TIME=`date +%T`

 echo Current Time: $CUR_DATE $OLD_TIME
 echo Changed Time: $CUR_DATE $NEW_TIME

 # makes wake up after +1 minute from now.
 echo $CUR_DATE $NEW_TIME > /proc/acpi/alarm
 
 #Save sysclock -> hwclock
 /sbin/hwclock --systohc --directisa
}

 

System Sudden off

 echo o > /proc/sysrq-trigger

sysrq — Activates the System Request Key, if this value is set to anything other than zero (0), the default.

The System Request Key allows immediate input to the kernel through simple key combinations. For example, the System Request Key can be used to immediately shut down or restart a system, sync all mounted file systems, or dump important information to the console. To initiate a System Request Key, type Alt-SysRq-<system request code>. Replace <system request code> with one of the following system request codes:

  • r — Disables raw mode for the keyboard and sets it to XLATE (a limited keyboard mode which does not recognize modifiers such as Alt, Ctrl, or Shift for all keys).

  • k — Kills all processes active in a virtual console. Also called Secure Access Key (SAK), it is often used to verify that the login prompt is spawned from init and not a trojan copy designed to capture usernames and passwords.

  • b — Reboots the kernel without first unmounting file systems or syncing disks attached to the system.

  • c — Crashes the system without first unmounting file systems or syncing disks attached to the system.

  • o — Shuts off the system.

  • s — Attempts to sync disks attached to the system.

  • u — Attempts to unmount and remount all file systems as read-only.

  • p — Outputs all flags and registers to the console.

  • t — Outputs a list of processes to the console.

  • m — Outputs memory statistics to the console.

  • 0 through 9 — Sets the log level for the console.

  • e — Kills all processes except init using SIGTERM.

  • i — Kills all processes except init using SIGKILL.

  • l — Kills all processes using SIGKILL (including init). The system is unusable after issuing this System Request Key code.

  • h — Displays help text.

 

reference:

 

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/en-US/Reference_Guide/s3-proc-sys-kernel.html

 

http://www.mythtv.org/wiki/ACPI_Wakeup

 

'geek_stuff > server & linux' 카테고리의 다른 글

우분투에서 itunes 서버 설치하기  (0) 2010.04.13
우분투 비밀번호 잃어버렸을 때  (0) 2010.04.07
vim에서 색상 지정  (0) 2008.11.21
아파치에서 ssl사용하기  (0) 2008.11.04
linux 보안 설정  (0) 2008.10.28