• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic