PDA

View Full Version : Possible to turn a computer into an alarm clock?



hatten
January 16th, 2009, 10:42 PM
I have a hard time getting up on the mornings (no i won't leave the comp earlier!:P) and my alarm clock sucks so i thought if it was possible to make the computer boot/revive from suspend/or just stay powered on the whole night and at a specific time start rythmbox (or any program) that starts playing music.

I believe that have the computer booting from power-off state can be like impossible to do, but if it's possible i will...be happy

Reviving from suspend could be able, or?

Doing it while the screen is locked (alternatively not even that) must be possible to do, right? Isn't it just to have a timer/countdown of some sort before launching a script?

I'm not entirely experienced with ubuntu, a few months, so don't tell me do that, say do like this. (more detailed)

JoshuaRL
January 16th, 2009, 10:59 PM
I'd suggest Songbird. You can get the deb from www.getdeb.net, and install it the normal way. Then go to the addons page and install Morning Peeps. It is an alarmclock addon, with a few features. Works for me.

uberdonkey5
January 16th, 2009, 11:13 PM
I think you have to keep the power on for this though?? (hmm not very environmentaly friendly).

If you want your computer to boot up you need to have an appropriate bios (basically, your software runs when computer has power, so how does it know it boot up??)

These links may help:
http://www.mythtv.org/wiki/ACPI_Wakeup
http://ubuntuforums.org/archive/index.php/t-317927.html

An alternative is to use the alarm on your mobile phone :D

hatten
January 16th, 2009, 11:48 PM
BIOS setting found and changed :popcorn:

But now it will boot to a login prompt. Of course i can skip that (right?) if i have to. But is it possible to have it start playing at login prompt, or only skip login prompt when BIOS have powered it on.

I'm playing around with songbird and are gonna look at startup applications. (that's what i should use, right?)

hatten
January 16th, 2009, 11:56 PM
If i boot comp at 6.55, skip login prompt, put songbird in startup applications and uses morningpeeps to start at 7.00. done:popcorn:


It is just the login prompt, I don't want anybody to be able to boot my comp and check all my personal stuff...

damis648
January 16th, 2009, 11:59 PM
I wrote a script for this a while back.
http://ubuntuforums.org/showpost.php?p=6227380&postcount=18
Directions here:
http://ubuntuforums.org/showpost.php?p=6225125&postcount=15

You will need festival first, though. Have a look at this (http://ubuntuforums.org/showthread.php?t=751169) guide.

Cheers!

hatten
January 17th, 2009, 12:50 AM
cool, but that's not what i want. But thanks anyway, i found out a way to use Rythmbox instead of songbird there too:P


Off to rebooting, hope it works =D

pp.
January 17th, 2009, 01:05 AM
It is just the login prompt, I don't want anybody to be able to boot my comp and check all my personal stuff...

Perhaps you can run some application without logging in, much like a daemon?

hatten
January 17th, 2009, 01:35 AM
EVerything works perfect...except for that Rythmbox refuses to start playing:(

system>preferences>sessions
I have added pidgin, transmission and checkgmail as simply one-word commandos that launches them.

I use the commando
rhythmbox-client --hide ; sleep 10 ; rhythmbox-client --playfor rythmbox, it works perfect in terminal but at rebooting it doesn't start to play for some reason.


Help will be appreciated


solved, i moved the code above into a file and let the startup manager launch that file. working. Let's see what happends tomorrow:guitar:



cannot the startup manager handle ";"'s?

hatten
January 17th, 2009, 10:08 AM
worked to perfection:popcorn:

Only thing i don't like is that now anybody can reboot my computer and get straight to my files, I'm thinking of making a new account just for that.

billgoldberg
January 17th, 2009, 10:32 AM
I just leave my pc on.

You could write a script and use cron to run it every morning.

But I just type in the command before I go to sleep.

I use this:


sleep 8h && vlc /path/to/music.mp3

This will play a music file 8 hours after entering the command.

You will need to keep the terminal window open.

xouns
January 23rd, 2009, 08:04 AM
But when I use (for instance) vlc /path/to/playlist(with brackets).m3u it says "bash: syntax error near unexpected token `('" and it won't run.

I have installed the program called Alarm Clock and it has the function to run a script at a specific time. What script should I use to let vlc run a playlist?

xouns
January 23rd, 2009, 08:10 AM
Ok, I get it, I can use

vlc "/path/to/any file/on my (harddisk).m3u"

And it works! Forgot to turn my volume down again. Since I use Ubuntu for downloading mostly, I leave my computer on during the nights, so that's not really a problem. This works great.

BTW, I love the test function in Alarm Clock, it saves me the annoyance of a not working alarm!

thegreenblob
January 23rd, 2009, 08:26 AM
I use a program called alarm-clock. Which I don't use it to wake me up but it can be used that way :P


sudo apt-get install alarm-clock

And just set it to run a command at a certain time. Such as:


vlc /path/to/a/mp3.mp3

andrewpmk
January 23rd, 2009, 09:41 AM
You don't even have to do that - you can set alarm-clock to play a sound file directly.

3rdalbum
January 23rd, 2009, 11:09 AM
at now + 8 hours
play "alarm.wav"


Then press Control-D, and in 8 hours time the sound file will play.

hatten
February 5th, 2009, 09:39 PM
Okay, i wanna wake up, keep my computer turned off and still save my uptime, by putting it into sleep mode or hibernating.

I read at a (vista) forum that the bios won't start the computer at a special time if the computer is hibernated, is it the same for linux?

Is it possible to wake by computer from sleep by running a command or anything similar?

Wv0wvw88wvw0vW
February 6th, 2009, 08:30 AM
Try KAlarm from Add/Remove Applications.

sharon.gmc
February 6th, 2009, 09:38 AM
I also use Songbird. I love it.

hatten
February 6th, 2009, 03:17 PM
Heck, are you even reading my post/earlier posts before replying? Well, thanks for trying anyway.

I found out that it worked to perfection to start playing music and then hibernating without pausing or stopping, then bios will boot my comp at a specified time and it will go directly to a locked screen asking me to enter possward while still playing music.:popcorn:

Nevon
February 6th, 2009, 04:18 PM
I've submitted an idea to brainstorm about this. I'd like to see an alarm function intergrated into the gnome-panel clock applet.

http://brainstorm.ubuntu.com/idea/17496/

mockdeep
February 24th, 2009, 04:30 PM
Hey everybody,

I'm trying to create an alarm clock script to wake me up in the morning and I'm having a problem getting it to run properly in cron. It looks like this:

#!/bin/bash
rhythmbox &
sleep 5
amixer -c 0 set Master 0% > /dev/null
rhythmbox-client --play
rhythmbox-client --hide
for ((x=0; x<100; x++))
do
amixer -c 0 set Master $x% > /dev/null
sleep 1
done

Basically, it starts rhythmbox music player and plays the default playlist while gradually increasing the volume. When I run it on its own it works fine, but when I add it to cron it doesn't. I added this line:

*/5 * * * * root /home/me/scripts/alarm.sh

Occasionally when it runs I will see rhythmbox pop up and quickly disappear, but it never starts playing. I can tell the script is running as the 'for' loop hijacks the volume control for 100 seconds until it's finished. Any ideas why it's not working? Could it have anything to do with the fact that rhythmbox is a graphical player?

keypox
August 28th, 2010, 04:19 AM
Any gui based program ever come out for this?

Ric_NYC
August 28th, 2010, 04:25 AM
Applications > Ubuntu Software Center... type "alarm"... enter
:p

keypox
August 28th, 2010, 07:51 PM
Applications > Ubuntu Software Center... type "alarm"... enter
:p

really? It will wake computer from suspend? No extra setup? I can't find any options that mentions suspend in the program.

keypox
August 28th, 2010, 11:44 PM
Is there any alarm that will wake the computer from suspend mode? Mac and windows have had these for years...

smellyman
August 29th, 2010, 12:02 AM
I suggest your mobile phone.....

nrs
August 29th, 2010, 12:07 AM
Hey everybody,

I'm trying to create an alarm clock script to wake me up in the morning and I'm having a problem getting it to run properly in cron. It looks like this:

#!/bin/bash
rhythmbox &
sleep 5
amixer -c 0 set Master 0% > /dev/null
rhythmbox-client --play
rhythmbox-client --hide
for ((x=0; x<100; x++))
do
amixer -c 0 set Master $x% > /dev/null
sleep 1
done

Basically, it starts rhythmbox music player and plays the default playlist while gradually increasing the volume. When I run it on its own it works fine, but when I add it to cron it doesn't. I added this line:

*/5 * * * * root /home/me/scripts/alarm.sh

Occasionally when it runs I will see rhythmbox pop up and quickly disappear, but it never starts playing. I can tell the script is running as the 'for' loop hijacks the volume control for 100 seconds until it's finished. Any ideas why it's not working? Could it have anything to do with the fact that rhythmbox is a graphical player?
Cron neuters PATH, to what extent I do not know. Try doing echo $PATH in your terminal and copy the result to your script.

mamamia88
August 30th, 2010, 09:31 PM
sleep 8h && vlc /path/to/music.mp3

This will play a music file 8 hours after entering the command.

You will need to keep the terminal window open.[/QUOTE] taking this one step farther you can create a simple bash script that will let play a song file after a certain user defined interval paste this into gedit and save it as whatever.sh.

#!/bin/bash
cd /home/username/music
sleep amount of time (h,m,s) && vlc nameofmusicfile.mp3

of course be sure to replace username with your username and correct name of the mp3. make the script executable and run it in a terminal. all you have to do is edit the amount of time depending on when you want to wake up.

markp1989
August 31st, 2010, 12:20 AM
sleep 8h && vlc /path/to/music.mp3

This will play a music file 8 hours after entering the command.

You will need to keep the terminal window open. taking this one step farther you can create a simple bash script that will let play a song file after a certain user defined interval paste this into gedit and save it as whatever.sh.

#!/bin/bash
cd /home/username/music
sleep amount of time (h,m,s) && vlc nameofmusicfile.mp3

of course be sure to replace username with your username and correct name of the mp3. make the script executable and run it in a terminal. all you have to do is edit the amount of time depending on when you want to wake up.[/QUOTE]

you could also have it so when you run the script you set the time like this:




#!/bin/bash
cd /home/username/music
sleep $1$2 && vlc nameofmusicfile.mp3


then run it like this

/path/to/script.sh 1 h for 1 hour delay .


a good option would be to use cron + mpd, becuase it would run even if your not loged in .

mamamia88
August 31st, 2010, 12:32 AM
what do the dollar signs do? is there a way to set up the script to play a music file at certain time? how about setting am pm? kind of curious i'm kind of new to this whole scripting thing in fact i seriously only started playing around with them yesterday.

markp1989
August 31st, 2010, 05:30 PM
what do the dollar signs do? is there a way to set up the script to play a music file at certain time? how about setting am pm? kind of curious i'm kind of new to this whole scripting thing in fact i seriously only started playing around with them yesterday.

$1 is the first command line parameter you parse to the script $2 is the 2nd etc.

eg:

mark@mark-laptop:~$ /path/to/script.sh parameter1 parameter2

in this case, $1=parameter1 and $2=parameter2

for more info , see here http://linuxreviews.org/beginner/bash_GNU_Bourne-Again_SHell_Reference/#toc7