Solved

causing the system to sleep or hybernate by code

Posted on 2004-09-13
5
199 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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