LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-30-2012, 11:20 AM   #1
mreff555
Member
 
Registered: Sep 2011
Location: Philly
Distribution: Gentoo
Posts: 473

Rep: Reputation: Disabled
sleep scripts


Does anyone have a good sleep script?

The commands below work great as long as I have superuser access and I type the command myself.

I would like to come up with an idle script and have had much trouble doing this. I haven't found anything online.
The only way I know to get idle time is from the "w" command but that is only based on individual programs and not the system.

I also don't want to introduce a loop that will tax the processor too much.

Any ideas on a good way to do this?

Code:
echo mem|tee /sys/power/state

or

echo disk|tee /sys/power/state
 
Old 12-30-2012, 01:38 PM   #2
alieblice
Member
 
Registered: Jul 2011
Posts: 80

Rep: Reputation: Disabled
im not sure if doing this going to work and if its safe but putting suid on your script might solve the problem .
make your scrip by super user and put sgid on it by chmod command. whenever a user exceute it , it will execute as super user.
 
Old 12-30-2012, 07:09 PM   #3
mreff555
Member
 
Registered: Sep 2011
Location: Philly
Distribution: Gentoo
Posts: 473

Original Poster
Rep: Reputation: Disabled
Right, I'm hoping to avoid that. what would be better if I could slip a couple of if statements in to a script periodically run with root permissions. The problem is that I don't know any scripts that are periodically run.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Going to Sleep tlcasey100 Linux - Newbie 1 03-04-2011 11:45 PM
Scripts to run after resume from sleep brixtoncalling Slackware 2 09-06-2009 04:27 PM
VPN: Debian Scripts -> Mandriva 2006 Scripts Undefined Mandriva 0 11-30-2005 01:10 PM
Searching for Server (BOOTP/DHCP) <sleep> <sleep> .. .. Eileen Linux - Networking 12 10-21-2005 02:14 AM
Need help running scripts from scripts sdouble Linux - Newbie 3 05-31-2004 01:56 PM


All times are GMT -5. The time now is 06:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration