0 Replies - 1055 Views - Last Post: 15 January 2008 - 06:01 AM

#1 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6544
  • View blog
  • Posts: 30,650
  • Joined: 10-May 07

Alarm Clock

Posted 15 January 2008 - 06:01 AM

Description: Add this command to the cron tab, to go off at the desired time.Use /dev/audio as a functioning alarm clock
#!/bin/sh
#
# This is just a script for fun, it'll check for the existence of
# /dev/audio, then play a bunch of random garbage.
#
# It really makes for a good alarm clock
#
# Written by -#2pencil- for Dream In Code 01/15/2008

# Variables, Configuration, & other Computer Jargon
infinite_loop = 0
i = 0
_rand = "/dev/random"
_audio = "/dev/audio"

# 1st, check for audio
if [ -e ${_audio} ]; then
  echo "Audio exists..."
else
  echo "Audio device does not exist"
  exit
fi

# 2nd, check for random
if [ -e ${_rand} ]; then
  echo "Random exists..."
else
  echo "Random device does not exist"
  exit
fi


# Loop plenty of times
if [ ${infinite_loop} -eq 0 ]; then
  while [  $i -lt 100 ]; do
    cat ${_rand} > ${audio}
    let i+=1
  done
else
  while [  1 -ne 2 ]; do
    cat ${_rand} > ${audio}
  done
fi


Is This A Good Question/Topic? 0
  • +

Page 1 of 1