Get Power on reason with linux

Posted on 2012-09-08
Last Modified: 2012-09-12
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.

Question by:acbxyz
    LVL 2

    Expert Comment

    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 f2:6e:05:25:AC:CA

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

    or you can just use DD-WRT ( which has a WOL feature on it.

    LVL 10

    Author Comment

    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.
    LVL 2

    Accepted Solution

    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.

    LVL 10

    Author Closing Comment

    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

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now