Link to home
Start Free TrialLog in
Avatar of acbxyz
acbxyzFlag for Germany

asked on

Get Power on reason with linux

Hello all,

I have a computer running linux, which can be powered on by its power button, via wake on lan and by acpi rtc timer of the bios. This is running fine.
But depending on how the computer was powered on I want a different behaviour.

Is it possible to find out the way the computer was turned on by a script?

Hardware is an ASUS E35M1-I Mini-ITX-Board, Software is the most recent Debian wheezy using kernel 3.2.0-3-amd64.

Thanks
Avatar of rumytaulu
rumytaulu
Flag of Indonesia image

If you have ubuntu or debian machine, there's a package on repository named "wakeonlan", install that package

sudo apt-get install wakeonlan

and make a cron like this :

00 06 * * * /usr/bin/wakeonlan -i 180.16.25.26 f2:6e:05:25:AC:CA

will turn your ASUS E35M1-I (with ip 180.16.25.26) ON everyday at 6:00 AM

or you can just use DD-WRT (http://en.wikipedia.org/wiki/DD-WRT) which has a WOL feature on it.

http://www.howtogeek.com/70084/how-to-schedule-your-computer-to-wake-up-at-specific-times-with-dd-wrt/

--
rumy
Avatar of acbxyz

ASKER

I don't want to know how to turn my machine on by wake on lan because this is already working very well. Additional it is already waking up on bios event at a specific time.


What I want to know is AFTER it has been powered on and booted, HOW it has been started.

Saying right after debian has booted, I want to start scripts depending on how the computer has been started.
I can guess a timer start by compare the last set alarm time and actual time. But I still want to know if the computer has been started by pressing the power on button or by receiving a wake-on-lan-package.

The reason why I ask here is because I only found mass of information how to do wake on lan and how to react on a power button event to handle shutdown.
ASKER CERTIFIED SOLUTION
Avatar of rumytaulu
rumytaulu
Flag of Indonesia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of acbxyz

ASKER

Turning on before the WoL-Packages arrives is exactly what I don't want.
I think I have to find another way to determinate the event.
Thanks anyway