• Post Reply Bookmark Topic Watch Topic
  • New Topic

detectng linux machine status(lock,hibernate)through java coding  RSS feed

 
vijaykumar kirar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone have java coding to detect a system's state( linux ) information about, if the system is in sleep.hibernation/standby mode.
 
Joe Ess
Bartender
Posts: 9439
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say it is unlikely that a program could detect a system is in sleep, standby or hibernate mode because the program would not be running in those states.
 
vijaykumar kirar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know how to detect the system state in windows. but in linux i have little knowledge but i know it is possible, I think it should be like this when the system is about to go sleep,hibernate or other states it gives a message to all running threads about it and then go into corresponding states.
 
Tim Holloway
Saloon Keeper
Posts: 18797
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell from one week to the next, because there are several power management standards and most hardware manufacturers seem to implement them badly - they just barely run with Windows (and on my old Compaq laptop, not even there). There was a big stink about a month back because Foxconn - who OEMs a lot of the mass-market products, including Dell and Apple - had a customer service rep rather rudely inform someone that they didn't care that their BIOS settings were broken for Linux. But a large public outcry made them restate that idea.

Probably the first place to check is the dBus, which has been supplanting CORBA as the internal desktop interprocess medium of choice. You may also find some info on ways to hook into the power management daemon itself. On my Fedora 8 system, there's an /etc/pm directory with subdirectories for sleep, power and config and without actually RTFM'ing, I'd bet that you can place event scripts into them the same way I can for my UPS daemon for things like handling low-battery events.

On second thought, you might want to look into dBus AFTER checking out the /etc/pm features. It's easier to prototype via scripts than binary programming.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!