LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-19-2005, 05:31 PM   #1
spx2
Member
 
Registered: Dec 2005
Distribution: debian
Posts: 160

Rep: Reputation: 30
problems with waking up


i have problems waking up in the morning
each and every morning.
i decided to write some code for a big(or little) alarm
shell script.
im thinking on using crond.
is it possible to get my computer on sleep mode ?
i dont have such buttons as sleep buttons on my keyboard.
i am asking this because i am sleeping not very far
from my computer 3meters and the sound from the cooler
is very annoying.
so i want to put it on sleep and also have crond run
so when morning comes about 8:00 ill have to be awake
so im thinking on going something like
mplayer /mnt/cdrom/01 - Guns N' Roses - Sweet Child O' Mine.mp3
that would be all...
i need some suggestions.
where to read about crond - some good paper.
where to read about options on playing with mplayer
how to put from console my computer on standby or sleep
so that it doesnt make that much noise and if it is still
crond conscient when it does that.
thanks
 
Old 12-20-2005, 04:01 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 68
To go sleep mode try echoing mem or standby to /sys/power/state. If you have /proc/acpi/alarm you can experiment echoing desired wake up time to it (try it first to understand how it works). Try running "sleep 100; mplayer somemusic.mp3" from other copnsole just before making computer go to sleep - when it wakes up 'sleep 100' will happily finalize and pass control to mplayer. So, the correct order:

echo <smth> >/proc/acpi/alarm
sleep 100 && mplayer <smth> &
echo <mode> >/sys/power/state

and no crond !
 
Old 12-21-2005, 02:05 AM   #3
spx2
Member
 
Registered: Dec 2005
Distribution: debian
Posts: 160

Original Poster
Rep: Reputation: 30
very nice solution mister
not even using crond
where should i read about this rather
interesting
/proc/acpi/alarm
/sys/power/state
?


and the natural order i understand
would be inverse to yours
like this :

echo sleep >/sys/power/state
sleep 100 && mplayer <smth> &
echo aaaaaaa >/proc/acpi/alarm


I would also like to see a solution with crond
if anyone can help
 
Old 12-21-2005, 11:56 AM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 68
In kernel documentation....
Well, cat /sys/power/state half-documents it, and some experiments clears the rest.
The same with alarm.

What you think is a good sequence, isn't:
first:
echo mem >/sys/power/state
--> after that computer goes to sleep. OK
sleep 100 && mplayer <smth> &
--> computer wakes up (!) and begins countdown
echo <time> >/proc/acpi/alarm
--> computer sets on alarm for getting up, though it will no go down.....
 
Old 12-21-2005, 08:58 PM   #5
smallville
Member
 
Registered: Dec 2005
Posts: 44

Rep: Reputation: 15
test message
 
Old 12-22-2005, 07:52 AM   #6
spx2
Member
 
Registered: Dec 2005
Distribution: debian
Posts: 160

Original Poster
Rep: Reputation: 30
so the computer needs to
1)sleep
2)wait some time (specified in the script)
3)wake up
4)play some music

the steps are in order first1 ,then 2 then 3 then 4.
if 2 and 3 are reversed all f**** up.
if they work in correct order all is good.
that is what i have to know.
thank you
 
Old 12-22-2005, 09:30 PM   #7
pats
Member
 
Registered: Jul 2005
Distribution: Debian Sarge/Etch, (K)Ubuntu, FC6, AIX5.3, VMWare ESXServer
Posts: 159

Rep: Reputation: 30
you might wanna check your bios settings as well to see if you can set it to turn on at a certain time. thats what i do. not as elegent as the other solutions but just as effective esp combined with an annoying start up sound!!!

may i also say by far the most ammusing post i've read all week
 
Old 12-22-2005, 09:38 PM   #8
Franklin
Senior Member
 
Registered: Oct 2002
Distribution: Slackware, Windows 7
Posts: 1,253

Rep: Reputation: 55
Quote:
i have problems waking up in the morning
Download gnucoffee.

Compile from source. (./configure --prefix=/strong && make && make_install)

Known dependencies:

cup
cream
sugar

If you don't want to compile your own there are binaries available at:

Starbucks
Dunkin Donuts

HTH
 
Old 12-23-2005, 08:41 AM   #9
spx2
Member
 
Registered: Dec 2005
Distribution: debian
Posts: 160

Original Poster
Rep: Reputation: 30
please raskin answer my last post.
i am not kidding
this is really serious
not at ALL AMUSING!
 
Old 12-25-2005, 02:16 AM   #10
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 68
1)sleep
2)wait some time (specified in the script)
3)wake up
4)play some music

Computer reacts to your actions. First, you should explain it when to wake up, as it doesn't affect other operations. Second you tell it to wait 2 minutes and play music. Before 2 minutes expire you tell it to sleep. It falls asleep - so, when 2 minutes expire, nothing happens, it doesn't play music while it is asleep. Then the wakeup time comes. So it wakes up and starts working. The shell gains control and finds out that sleep has expired. So in the sequence "sleep && mplayer" the second command is run only now, when computer is again up.
 
  


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
ACPI shuting down when should be waking up navarre9 Linux - General 1 12-25-2005 02:18 AM
Not waking from second suspend ritme909 Linux - Laptop and Netbook 0 01-29-2005 07:19 AM
dpms: stop from waking apberzerk Linux - General 1 10-17-2004 04:52 PM
Waking up only one process from a wait queue serkult Programming 3 05-12-2004 03:12 AM
Is it just me or is Linux waking up? orange400 Linux - General 2 03-03-2003 05:15 AM


All times are GMT -5. The time now is 09:21 AM.

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