Skip to content

Instantly share code, notes, and snippets.

@meskarune
Created June 19, 2012 19:49
Show Gist options
  • Save meskarune/2956149 to your computer and use it in GitHub Desktop.
Save meskarune/2956149 to your computer and use it in GitHub Desktop.
Tester Tocsin Program
#! /bin/bash
#
#Tocsin - Plays a Chime at the Hour and Quarter Hour
#
# You can change the paths to any sound files you'd like, but paths must be absolute for cron to work
# This script uses mpg123 to play the mp3 chime files. Alternative programs would be aplay, ogg123, and madplay.
#Quarter Chime Variables
fifteen="/home/meskarune/GIT/tocsin/chimes/quarter1.mp3"
thirty="/home/meskarune/GIT/tocsin/chimes/quarter2.mp3"
fortyfive="/home/meskarune/GIT/tocsin/chimes/quarter3.mp3"
# Hour Variable
hour=`date +%I`
# Hour Chime Variable
hourchime="/home/meskarune/GIT/tocsin/chimes/$hour-hour.mp3"
# Chime the Hour when minutes = 00 and Quarter Hours on the 15, 30,
# and 45 minute marks.
case "$(date +%M)" in
00)
mpg123 -q $hourchime
;;
15)
mpg123 -q $fifteen
;;
30)
mpg123 -q $thirty
;;
45)
mpg123 -q $fortyfive
;;
esac
@meskarune
Copy link
Author

mplayer -softvol -volume 25 $hourchime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment