I meditate in my living room with my Linux computer running.
There is a dearth of kitschy little counter apps for Linux desktops as there are for Windows.
So I made myself a Bash script to play a gong audio file. Been using it for years. Recently I accidentally deleted it when moving to a new hard drive. I had to recreate it.
I thought I would do two nice things with the same action by posting the script here. Others can use it and should I lose it again I can find a copy of it on the web :).
You can download the audio file by clicking this link
Just paste the script quoted below into a file on your *nix computer and read the top for instructions on how to set it up.
Enjoy!
#!/bin/bash
################################################################################
##
## File: meditationTimer
##
## Purpose: Count down and display the number of minutes left. Play an audio
## file when done.
##
## Usage: Type the name of the script followed by the minutes desired
## Example: count down two hours
##
## meditationTimer 120
##
## Setup: 1. Install the package called “sox” on your Linux system
## 2. Place the meditationTimerBell.wav file in the same directory as
## this script.
## 3. Set the permission on both files with chmod 755 theFileName
##
################################################################################
# Get the current directory so that the audio file placed in the same
# directory can be found
directory=`dirname "$0"`
# If minutes in whole numbers only is not supplied on the command line.
if [[ -n ${1//[0-9]/} ]]; then
echo "Please supply a value for minutes,only minutes,and only whole numbers."
exit
fi
# Convert the input argument of minutes into seconds to count down.
sec_rem=`expr 60 \* $1`
# Calculate and print the time left
while [ $sec_rem -gt 0 ]; do
clear
let sec_rem=$sec_rem-1
interval=$sec_rem
seconds=`expr $interval % 60`
interval=`expr $interval - $seconds`
minutes=`expr $interval % 3600 / 60`
interval=`expr $interval - $minutes`
hours=`expr $interval % 86400 / 3600`
printf "\nMeditation Timer:\n\n"
printf "%02d:%02d:%02d" $hours $minutes $seconds
sleep 1
done
printf "\n\n"
# Play the audio file for the bell
play $directory/meditationTimerBell.wav
printf "\n\n"
################################################################################
## END OF FILE: meditationTimer
################################################################################