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
LVL 10
acbxyzAsked:
Who is Participating?
 
rumytauluConnect With a Mentor Commented:
Sorry I read the question wrong ;)

For that, you can just turn on your machine before the estimated wake on lan boot, trace the incoming package via iptraf or wireshark, and hopefully get the ip address of the machine that boot your computer.

--
rumy
0
 
rumytauluCommented:
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
0
 
acbxyzAuthor Commented:
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.
0
 
acbxyzAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.