Anites/Big Ben

Anites: Big Ben Clock - Raspberry Pi - http://www.anites.com/2014/11/big-ben-clock.html

cronjob schedule:
 * 1) Big Ben
 * 2) hourly from 7am to 10pm
 * 3) 0 7-22 * * *  /opt/big_ben/big_ben.sh > /dev/null

Alternate schedule: 0 7-22 * * 1-5 /opt/big_ben/big_ben.sh > /dev/null
 * 1) Big Ben
 * 2) hourly from 7am to 10pm
 * 3) 0 7-22 * * *  /opt/big_ben/big_ben.sh > /dev/null
 * 4) hourly from 7am to 10pm MON-FRI

big_ben.sh:
 * 1) !/bin/bash


 * 1) Author: Kenneth Burgener  2014
 * 2) Purpose: Determine hour and play appropriate Big Ben MP3


 * 1) crontab: (from 7am and 10pm)
 * 2) 0 7-22 * * *  /opt/big_ben/big_ben.sh > /dev/null


 * 1) Audio files: https://www.dropbox.com/s/op69s9jh71w9npf/big_ben.zip

HOUR=`date +%l` HOUR=$(( $HOUR ))
 * 1) Get hour (1-12) for mp3 file

MILHOUR=`date +%k` MILHOUR=$(( $MILHOUR ))
 * 1) Get military hour (1-24) for math below

if [ $MILHOUR -le 8 -o $MILHOUR -ge 20 ] ; then # 8am and earlier, 8pm and later #/usr/bin/amixer set PCM 80% > /dev/null /usr/bin/amixer set PCM 90% > /dev/null else # 9am to 7pm #/usr/bin/amixer set PCM 95% > /dev/null /usr/bin/amixer set PCM 91% > /dev/null fi
 * 1) Set audio volume depending on time of day

/usr/bin/mpg123 /opt/big_ben/audio/big_ben_$HOUR.mp3 2> /dev/null

Audio files: https://www.dropbox.com/s/op69s9jh71w9npf/big_ben.zip