November 27, 2010
When I’m working on my computer, I often lose track of time. In itself I don’t mind this, but the downside is that I often am not aware of the different sandhyas, the different phases of the day (sunrise, noon and sunset) at which I should meditate on the Gayatri mantras I received at initiation.
Luckily, with Linux it is very easy to have your computer remind you that it is nearly time to chant. All you need is crontab and gxmessage. Crontab is part of the default installation of many distributions, and gxmessage is easily installed (. Here is how you would do it.
First of all, you’ll need to create a Gxmessage script. Here is what I use:
gmessage "It is time to chant your Gayatri mantras" -center -title "Take action" -font "Sans bold 7" -geometry 300x100 -default "Remind me later" -center -buttons "_Remind me later":1,"I'll _chant now":2 >/dev/null
case $? in
(sleep 10m && /home/USERNAME/.scripts/Gayatri_gmessage);;
Save the file in a convenient location as (I keep it in ~/.scripts/) as Gayatri_reminder or whatever else you like, and make the file executable with the following command:
chmod +x /home/USERNAME/.scripts/Gayatri_reminder
(Wherever you save it, make sure that the line which reads “sleep 10m && /home/USERNAME/.scripts/Gayatri_gmessage” in the above example points to the location of your script.)
If you’d like to test the script, you should be able to either double click on the file, or to enter the full path to the file in a terminal to launch Gxmessage. The script should launch a window that looks like this (it should follow your general Gtk theme):
If you click “Remind me later” the window will pop up again 10 minutes later; if you click “I’ll chant now” the message will simply close. You can change those settings (including the text that is displayed) by editing the script I gave above.
Now you’ll need to tell your operating system that you want this script to be run every day at noon and at 6pm. To accomplish this, you can use cron and crontab. Cron is a daemon that executes scheduled commands. It is normally started automatically when you start your computer. Crontab is a little application that allows you to add or remove scheduled commands for individual users. To add an entry for your Gayatri reminder message, start crontab in the edit mode with the following command:
If you have never used crontab before, an empty file should open that looks like this:
# m h dom mon dow command
This indicates the structure you need to use for crontab entries: for each entry you can specify the minute (0-59), the hour (0-23, 0 = midnight), the day of the month (1-31),the month (1-12), and the day of the week (0-6, 0 = Sunday), and finally the command you want to be executed at that time. If you want to run a command every day of the month, or every day of the week, you can enter an asterisk (*) as the value to that setting.If you want to cron to launch an application with a graphical user interface, such as Gxmessage, you need to specify what screen to display it on with the command export DISPLAY=:0. If you only have a single screen, you need to use DISPLAY=:0; if you have more than one screen and would like the message to appear not on the first screen change the number accordingly (to :1 or :2).
So if you want this Gxmessage script to be run every day at noon,and at 6pm, you would add two entries in crontab that looks like this:
00 12 * * * export DISPLAY=:0 && /home/USERNAME/.scripts/Gayatri_reminder
00 18 * * * export DISPLAY=:0 && /home/USERNAME/.scripts/Gayatri_reminder
This will run the script every day of every month and every day of the week (the three *s) at 00 minutes past 12 and 18 hours. The command part of each line ( export DISPLAY=:0 && /home/USERNAME/.scripts/Gayatri_gmessage) specifies that the Gayatri_reminder script is to be run on the first screen.
There are some obvious drawbacks to this system. If you want to be very strict and meditate on the Gayatri mantras at the exact sandhya times, this method is not very practical, unless you live close to the equator where the sunrise, sunset and when the sun reaches its zenith are nearly at the same time of day all year round. I started writing a script that took the exact sunset times into consideration, and had some success, but lost that script and can’t be bothered to rewrite it. Maybe I’ll revisit it in the future, but for now this system works fine. I’d rather chant my Gayatri mantras slightly off time, than forget them entirely.