Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is there a way to find out how the computer was started...?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
uotika
n00b
n00b


Joined: 08 Jul 2007
Posts: 4

PostPosted: Sun Jul 08, 2007 8:12 pm    Post subject: Is there a way to find out how the computer was started...? Reply with quote

Hello,

Can anyone tell me if there is any way to find out (with software) what started the computer? In other words, I'd like to know if the PC was started by the user pressing the power button, or if it was started by an ACPI timer event.

Just in case you're wondering why would I need to know something like that, it's because I have built myself a HTPC using (Gentoo) Linux and VDR, and there I need to know if the PC was started by the user, or by a timer event. This is because I need to know whether or not to enable the auto shutdown feature of VDR at startup.

Now I accomplish this by checking if a preprogrammed VDR timer event is nearby, if yes then I assume the PC was started by a timer event. But this is not a 'clean' or 'nice' a solution, it would be much clearer to have the abovementioned info available.

Thanks for your time,
Kari
Back to top
View user's profile Send private message
geforce
l33t
l33t


Joined: 29 Dec 2003
Posts: 653
Location: Canada

PostPosted: Mon Jul 09, 2007 8:41 pm    Post subject: Reply with quote

As far as I know, there is no logs for PC boots, even for timed events.
_________________
User #29433
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Mon Jul 09, 2007 10:10 pm    Post subject: Reply with quote

just an idea... can't u take a look at the mouse/keyboard, and if in the first x minutes there is no activity -> log + halt, else end skript
Back to top
View user's profile Send private message
uotika
n00b
n00b


Joined: 08 Jul 2007
Posts: 4

PostPosted: Tue Jul 10, 2007 2:56 pm    Post subject: Reply with quote

Thank you for the info and suggestion.

However, the 'no activity' solution is not feasible, because the user might just power on the PC and TV and then do nothing else (but watch the TV, obviously). Besides, there is no mouse nor keyboard in the system, it's controlled solely with a remote control.

But thanks anyway for the effort, much appreciated!

-Kari
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Wed Jul 11, 2007 6:24 am    Post subject: Reply with quote

Could you not perform similar monitoring of the remote?
Back to top
View user's profile Send private message
jlh
Tux's lil' helper
Tux's lil' helper


Joined: 06 May 2007
Posts: 145
Location: Switzerland::Zürich

PostPosted: Thu Jul 12, 2007 12:06 am    Post subject: Reply with quote

If I get this correctly, you have timers that will make the machine boot up automatically to record things, but it should also shut down automatically after it's done. However, if the user started the machine explicitely, there should be no automatic shutdown.

I would say that the information about how the system was started (timer, or user) is irrelevant here. If the user has interacted (via remote or anything else) with the system in any way while it was up, then do not shut down automatically (even if the system was actually started by a timer; at least I'd expect that behavior as a user). If there was no user interaction at all since boot up and there was a timer scheduled, then shut down automatically.
Back to top
View user's profile Send private message
uotika
n00b
n00b


Joined: 08 Jul 2007
Posts: 4

PostPosted: Sat Jul 14, 2007 11:57 am    Post subject: Reply with quote

Thank you again to all of you for the suggestions, but the user activity solution is not 100% waterproof. It is almost, but not quite.

What makes it unreliable, is this scenario:

1. The user starts the system by pressing the power button.
2. The user does not do anything else for a certain period of time, which exceeds the inactivity timeout value. He could just start watching the channel which is on when the system starts, or he might do something else while waiting for a certain programme to start. This would result in the system shutting down itself, which would be unexpected by the user. In the worst case scenario, the system could shut down just when the user was about to start recording something.

I agree this is not very common a scenario. Usually the user actually does something with the system, but that's something I cannot count on.

Thanks,
Kari
Back to top
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Sun Jul 15, 2007 3:28 am    Post subject: Reply with quote

Is there some way you could replace the power-on button with one that has two sets of contacts, and then wire a simple something to the second pair that puts out a signal that your startup script could check for?

I'm thinking something along the lines of, take apart a old usb mouse, find the contacts of one of the mouse buttons and (carefully!) wire it to the second set of power contacts, and plug the usb into a spare port.

It'll probably have to be the 'push down and stays down' variety since a momentary press is unlikely to be sensed by the time boot finishes. Or perhaps use a capacitor to hold a charge long enough to sense button-down.
Back to top
View user's profile Send private message
MotivatedTea
Apprentice
Apprentice


Joined: 06 Nov 2006
Posts: 269
Location: Toronto, Canada

PostPosted: Sun Jul 15, 2007 5:44 am    Post subject: Reply with quote

I came across something that might do what you're looking for: IPMI (Intelligent Platform Management Interface). I'm afraid I can't do much more than point you at some links. I've never set it up, and it doesn't appear to be supported by my current systems. However, if you're lucky, your BIOS (or some related part of your system board) may be storing the information you want, and impitool might be able to read it for you.

This looks like a good place to start: http://buttersideup.com/docs/howto/IPMI_on_Debian.html. It's for Debian, but the two packages they refer to (ipmitool and openipmi) are both in portage. The first example on that page shows you that, if everything works, you'll get output like this:
Code:

# ipmitool -I open chassis status
System Power         : on
Power Overload       : false
Power Interlock      : inactive
Main Power Fault     : false
Power Control Fault  : false
Power Restore Policy : previous
Last Power Event     : ac-failed
Chassis Intrusion    : inactive
Front-Panel Lockout  : inactive
Drive Fault          : false
Cooling/Fan Fault    : false

So maybe the "Last Power Event" status might change depending on how your system was powered up? As I said, I've never set this up before. I hope I'm not sending you down a wrong path that will waste hours of your time... (Then again, you're running Gentoo, so you obviously don't mind tinkering with things.) What you need now is an IPMI guru!
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Sun Jul 15, 2007 5:17 pm    Post subject: Reply with quote

uotika wrote:
Thank you again to all of you for the suggestions, but the user activity solution is not 100% waterproof. It is almost, but not quite.

What makes it unreliable, is this scenario:

1. The user starts the system by pressing the power button.
2. The user does not do anything else for a certain period of time, which exceeds the inactivity timeout value. He could just start watching the channel which is on when the system starts, or he might do something else while waiting for a certain programme to start. This would result in the system shutting down itself, which would be unexpected by the user. In the worst case scenario, the system could shut down just when the user was about to start recording something.

I agree this is not very common a scenario. Usually the user actually does something with the system, but that's something I cannot count on.

Since this solution works most of the time, one way to patch it is to pop up a little nag screen 5 minutes before auto-shutdown saying your are going to auto-shutdown. If the user press the "any" key, the nag screen goes poof and you go into manual mode.

BTW: I always fiddle with the remote when I watch tv or dvds. In my house the nag screen would never appear. If I never used the remote it would mean that I had turned on the tv and then forgot about it so the auto shutdown even after a manual start would be a feature and not a bug (for me).
Back to top
View user's profile Send private message
uotika
n00b
n00b


Joined: 08 Jul 2007
Posts: 4

PostPosted: Sun Jul 15, 2007 9:38 pm    Post subject: Reply with quote

Thanks for the comments again!

This IPMI thing really looks like it could be just the thing I was looking for. I'll have to dig in to it and see if I can make it work. I'll let you know (in case someone is interested) if I can get it to work. If not, then some kind of hardware solution might come into question, too, but that, of course, means more work, so I'll have to think about it, if it really is worth the trouble.

-Kari
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum