LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 02-05-2012, 03:25 PM   #1
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 86

Rep: Reputation: 4
Sleep and Wake scheduling


Hello all,

I have the concept of a script that enables a user to schedule when the machine goes to sleep and when it wakes up.

I have written a bash script that writes everything directly to the user crontab file. The minutes (21), hour (20), and seconds to wake (14400) up are written to the crontab file like so:
Code:
21 20 * * * /usr/sbin/rtcwake -m mem -s 14400
I have a crontab scheme that goes like the following:
Code:
* * * * * $HOME/.bin/executable1
* * * * * $HOME/.bin/executable2
So as of current my script violates my crontab scheme. I have tried to write a second script that writes to my crontab file and a file titled: going_to_sleep. The timing seems to be off with my second script and I have no idea what maybe wrong. As you may have guessed this file is located in $HOME/.bin/

Script1.txt is the first script that I describe.
Script2.txt is the second script that I describe.
going_to_sleep.txt is the file that I would like to be edited by the second script.

UPDATE!

I have been playing with this idea some more and I cleaned up my script a little bit. The new file name is script3.txt. I am trying to get the date part to actually say the adjusted time for sleephours and sleepminutes. I can make the date command state the date with an adjusted hour with no issue. It is when I add the sleepminutes variable to it is when I get errors. Anyone know how to adjust the hour and minute of the date command at the same time?
Attached Files
File Type: txt script1.txt (1.6 KB, 4 views)
File Type: txt script2.txt (1.8 KB, 4 views)
File Type: txt script3.txt (1.4 KB, 0 views)

Last edited by lonesoac0; 02-12-2012 at 02:35 PM. Reason: updating of the situation.
 
  


Reply

Tags
bash scripting, cronjob, datetime, math


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wake up from sleep on USB detection xerox Linux - Software 0 11-06-2011 09:31 PM
Display goes to sleep on boot - won't wake up without X! Clean3d Ubuntu 1 01-27-2008 08:39 PM
Mouse wont wake after sleep mode icedfusion Ubuntu 3 09-11-2006 09:23 PM
how to wake up from S3 acpi sleep state? bluesmanu Linux - Laptop and Netbook 4 01-15-2006 03:22 PM
Screen does not wake up after going to sleep at promp PSIPHON Linux - General 1 08-09-2005 08:30 PM


All times are GMT -5. The time now is 06:41 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration