Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

causing the system to sleep or hybernate by code

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

688 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