Solved

causing the system to sleep or hybernate by code

Posted on 2004-09-13
5
191 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
  • 2
  • 2
5 Comments
 
LVL 45

Expert Comment

by:sunnycoder
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

11 Experts available now in Live!

Get 1:1 Help Now