Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

causing the system to sleep or hybernate by code

Posted on 2004-09-13
5
Medium Priority
?
208 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
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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

885 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