Turn your computer into a digital radio alarm clock

Forum rules
Before you post please read this

Turn your computer into a digital radio alarm clock

Postby Pilosopong Tasyo on Thu Jul 21, 2011 10:48 am

Ok, this post is a result of this previous thread. I made a few refinements vis-a-vis to the originating thread. To those who are interested, you might want to try this out. Edit wherever appropriate (i.e., filenames, locations, etc.).

/home/administrator/scripts/radio-alarm.sh
Code: Select all
#!/bin/sh

# Turn your computer into a digital radio alarm clock.
# Use cron to schedule the script to trigger at the designated
# date and time of your choosing.

# Change the following URL to your choice of online stream
STREAMING_ADDRESS=http://eradioportal.com/monsterRx.asx

# Mute the speakers.  You don't want to be rudely awakened
# by a sudden rush of sound from the speakers now, do you?
amixer -q set Master 0

# Let's use VLC to stream content.
DISPLAY=:0 vlc $STREAMING_ADDRESS &
sleep 10  # A 10-second wait should be enough time to fill up the buffer.

# Gradually turn the volume up in 5% increments every 2 seconds
for STEP in `seq 5 5 100`
do
  amixer -q set Master $STEP%
  sleep 2
done

# EOF

Edit your cron table in terminal:

Code: Select all
crontab -e

And add a new entry at the end of the file (the following as an example):

Code: Select all
# m h  dom mon dow   command

# Wake me up every 6:30 am, Monday through Saturday, all year round
30 6 * * 1-6 /home/administrator/scripts/radio-alarm.sh

Save the new cron table and you're done.

Here's an online cron job generator you can use: http://www.generateit.net/cron-job/
Image
o Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime!
o If an issue has been fixed, please edit your first post and add the word [SOLVED].
User avatar
Pilosopong Tasyo
Level 6
Level 6
 
Posts: 1181
Joined: Mon Jun 22, 2009 3:26 am
Location: Philippines

Linux Mint is funded by ads and donations.
 

Re: Turn your computer into a digital radio alarm clock

Postby Habitual on Thu Jul 21, 2011 12:00 pm

You are my new Best Friend. 8)
What's a landing but a take off in reverse?
User avatar
Habitual
Level 8
Level 8
 
Posts: 2213
Joined: Sun Nov 21, 2010 8:31 pm
Location: LM17Q-Xfce

Re: Turn your computer into a digital radio alarm clock

Postby Pilosopong Tasyo on Thu Jul 21, 2011 6:54 pm

Habitual wrote:You are my new Best Friend. 8)

This new section in the forum is quite inspiring. :D

I'm glad you made a request to create a section specifically for shell scripting. It's a fantastic idea and anybody can contribute solutions to questions posted in the forum that only require a shell script instead of a full-blown application.

Come to think of it, there's another thread somewhere in the forum that can be addressed using a shell script. I'll have to dig in my posts sometime later and write a tutorial about it. :twisted:

Regards! :mrgreen:
Image
o Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime!
o If an issue has been fixed, please edit your first post and add the word [SOLVED].
User avatar
Pilosopong Tasyo
Level 6
Level 6
 
Posts: 1181
Joined: Mon Jun 22, 2009 3:26 am
Location: Philippines

Re: Turn your computer into a digital radio alarm clock

Postby Habitual on Thu Jul 21, 2011 7:08 pm

Well, I am glad that we can come together and hopefully inspire others to take up the craft.
You got skills and good style too, # comments everywhere. :)
What's a landing but a take off in reverse?
User avatar
Habitual
Level 8
Level 8
 
Posts: 2213
Joined: Sun Nov 21, 2010 8:31 pm
Location: LM17Q-Xfce

Re: Turn your computer into a digital radio alarm clock

Postby dritzominous on Fri Jul 22, 2011 2:30 pm

Excellent idea to raise the volume gradually.

Never thought of that.
User avatar
dritzominous
Level 3
Level 3
 
Posts: 160
Joined: Sat Nov 14, 2009 12:49 am

Re: Turn your computer into a digital radio alarm clock

Postby CyberJet on Thu Aug 11, 2011 3:10 pm

I agree, it's great idea! I'll be looking forward to learn something from this section. I have never written a script so I'll be paying attention.

Thanks to all for your dedication to this forum. Noobs will benefit.

Regards,
User avatar
CyberJet
Level 1
Level 1
 
Posts: 8
Joined: Sun Aug 07, 2011 7:37 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest