Solved

causing the system to sleep or hybernate by code

Posted on 2004-09-13
5
203 Views
Last Modified: 2010-04-22
hi, is there any system call, or function on the C libraries to make the system sleep or hyernate?
if there is, any examples?

basically i'm trying to create a small command line program that will perform only that action, as part of a bigger program.

thanks, any help is appreciated.
0
Comment
Question by:urif
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12051764
I do not think there is an API ... there was some ongoing work but I do not think it has been finished yet. You can check the latest kernel release to see if the support has been included on experimental basis. If not, then you will have to modify the kernel in order to add this feature
0
 
LVL 22

Expert Comment

by:NovaDenizen
ID: 12057716
You need to use ACPI.  The ACPI project has a sourceforge site at http://acpi.sourceforge.net/

Make sure you have ACPI compiled into your kernel.  If you dowload and install pmtools, you will have some utilities that help you deal with the arcane innards of acpi.

Some computers only support ACPI, and some only support APM.  ACPI for kernel 2.6 has a different system-level interface than that for 2.4 kernels.  2.4 kernels don't support suspend-to-ram.  

To directly interact with ACPI, you read from and write to the relevant interface files under /proc/acpi/ (for 2.4 kernels) or /sys/power/ (for 2.6 kernels).

0
 

Author Comment

by:urif
ID: 12058309
i actually found this:

xset dpms force (standby|suspend|off)

it worked on a normal deskopt pc, but not on the laptop.

it's weird tho that i need to recompile the kernel for such a thing
0
 
LVL 22

Accepted Solution

by:
NovaDenizen earned 100 total points
ID: 12058371
I believe dpms is just the energystar feature for the monitor.  That may have been what you meant, but you asked about putting parts of your system to sleep, and for that you need ACPI.

0
 

Author Comment

by:urif
ID: 12072353
if that's the only solution then i think i'll quit here. i don't want to recompile kernels, do all kind of system adjustment to be able to send the system to standby... that's ridiculous.

thanks anyway
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 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