You are not logged in.

#1 2010-09-17 04:53:39

duke11235
Member
Registered: 2009-10-09
Posts: 221

Linux Alarm Clock

I have an alarm clock in Mac that wakes up my computer from sleep at predestined time and plays my selected music. I was wondering if there was a linux equivalent that could wake up the computer, so I wouldn't have to return to Mac every night.

Offline

#2 2010-09-17 06:37:38

PirateJonno
Forum Fellow
From: New Zealand
Registered: 2009-04-13
Posts: 372

Re: Linux Alarm Clock

http://www.mythtv.org/wiki/ACPI_Wakeup

The gist of it is:

# date -d TIME +%s > /sys/class/rtc/rtc0/wakealarm

"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page

Offline

#3 2010-09-17 06:54:25

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: Linux Alarm Clock

#!/bin/bash
### Wake-Up Alarm ##############
# Version 0.1 by Scott Garrett #
# Wintervenom [(at)] gmail.com #
################################

volume () {
  case "$2" in
    'up') amixer -c0 set $1 1+ ;;
    'down') amixer -c0 set $1 1- ;;
    *) amixer -c0 set $1 $2 ;;
  esac
}

# In case we are connected to an amplifier.
mpc stop
volume Master 20
volume PCM 100

# So our Last.fm account doesn't get filled with night-playlist entries.
#killall mpdscribble &> /dev/null
killall mpdas &> /dev/null

# Queue the night playlist.
mpc consume off
mpc random on
# Make very smooth transitions to new songs.
mpc crossfade 10
mpc clear
mpc load 01-Aesthetic
mpc play

# Wait until the time specified by the user (in %H%M format) to wake up.
echo "Sleeping until $1."
until [ "`date +'%H%M'`" = "$1" ]; do
  sleep 5
done

# We can start scrobbling again.
#mpdscribble &
mpdas -d
mpc pause

volume Master 0
mpc clear
mpc load 00-Favorites
mpc next
mpc play

# Gracefully increase the volume of the music until you wake up.
for ((x=0; x<100; x++)); do
  volume Master $x
  sleep 1
done

Syntax:  $(night WAKEUP_TIME), where WAKEUP_TIME is in HHMM format.

Last edited by Wintervenom (2010-09-17 06:57:17)

Offline

#4 2010-09-17 17:55:21

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Linux Alarm Clock

Wintervenom, just a friendly suggestion.

Can you not use the various colors in your posts? I use a dark theme and man it makes it difficult to read the blue and green in your post.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#5 2010-09-17 20:13:43

hatten
Arch Linux f@h Team Member
From: Sweden, Borlange
Registered: 2009-02-23
Posts: 736

Re: Linux Alarm Clock

Check out rtcwake. I use it extensively.

Offline

#6 2010-09-19 20:31:30

devadittya
Member
From: Bangalore
Registered: 2009-11-16
Posts: 127
Website

Re: Linux Alarm Clock

I use kalarm on KDE4. Pretty sweet.

Offline

Board footer

Powered by FluxBB