How to setup a perfect "email or pop-up reminder" with Linux

18 July, 2005
Keywords: Linux task scheduler, e-mail reminder, pop-up reminder, cron, remind, tkremind

If you have just migrated from MS-windows sure you will be looking for a simple application for all your reminders. I was using a cool little application called "Kirby alarm" when I was using windows and I really loved it as the Kirby alarm says "
Kirby Alarm is a completely free alarm and task scheduler that will pop up a note, or run a program, or play a sound, or send an email at user defined intervals". I was looking for some thing similar under Linux. It took a while to make things work. At the end I could do some thing similar (may be more) with couple of applications. I am very happy that I culd learn to do much more than what I used to do with Kirby-alarm.

You can expect pop-ups like the following from our reminder tools!



Figure 1: Pop-up from "xmessage"





Figure 2: Pop-up from "Xdialog"




Figure 3: Pop-up from "kdialog"






1) Tools needed for pop-up reminder (XWindows)

Solution-1) cron, xmessage/Xdialog/kdialog Solution-2) remind + tkremind


Solution-1) cron, xmessage/Xdialog/kdialog
I like this as we need only cron and either of the three programms (xmessage or Xdialog or kdialog.)

All we need is to enter proper linux commands in to crontab so that the message needed will pop-up at scheduled time.

Here is how I do:
First try weather any of the three message programs [xmessage/Xdialog/kdialog]work for you. Type the following command in your shell/console window:

date '+Reminder issued at: %H:%M %p' | xmessage -buttons OK:0 -title "Jag's Reminder" -nearmouse -file - -timeout 8


A pop-up window [see Figure-1] will appear near mouse and disappear after 8 seconds.

/usr/bin/Xdialog --rc-file ybox.rc --title "Reminder" --backtitle "coffee time" --clear --under-mouse --no-button --right --infobox "You need a coffee, dont you?" 0 0 8000

A pop-up window
[see Figure-2] will appear in the center and disappear after 8 seconds.

Note: for getting "yellowbackground and blue text you should have "ybox.rc" in your home directory with following entry:

---------content of "ybox.rc" file -------

style 'yellow_background' {
bg[NORMAL] = { 1.0, 1.0, 0.0 }
fg[NORMAL] = { 0.0, 0.0, 1.0 }

font = "-adobe-times-bold-r-normal--25-180-100-100-p-132-iso8859-1"

}
widget '*' style 'yellow_background'

Similarly we can use "kdialog", enter the following command

kdialog --title "Jag's reminder" --passivepopup "This is my reminder message" 8

A message pop-up
[see Figure-3] will appear at the top-left cornor and will stay for 8 seconds.

If any of the above works just enter that command in your crontab. But we need to tell the cron to display it on Xserver by inserting "DISPLAY=:0.0" before message command i.e. "xmessage or kdiallog or Xdialog" It is also safe to put full path of the message command. Type "whereis" and your command to find out full path of your favourite message command. On my linux-box they are located at "/usr/X11R6/bin/xmessage", "/usr/bin/Xdialog", "/usr/bin/kdialog"

Now for getting pop-up message every 5 minutes between 1.00 - 1.30 PM

Issue the command "crontab -e" you will be thrown in to a VIM editor. Type "i", you will enter insert mode. At insert mode,
cut and paste one of the following three lines in your crontab.
# Pop-up message using xmessage
00-30/5 13 * * 1-5 DISPLAY=:0.0
date '+Reminder issued at: %H:%M %p' | /usr/X11R6/bin/xmessage -buttons OK:0 -title "Jag's Reminder" -nearmouse -file - -timeout 8

# Pop-up message using Xdialog
00-30/5 13 * * 1-5 DISPLAY=:0.0
/usr/bin/Xdialog --rc-file ybox.rc --title "Reminder" --backtitle "coffee time" --clear --under-mouse --no-button --right --infobox "You need a coffee, dont you?" 0 0 8000

# Pop-up message using kdialog
00-30/5 13 * * 1-5 DISPLAY=:0.0
/usr/bin/kdialog --title "Jag's reminder" --passivepopup "This is my reminder message" 8

After pasting press 'Esc' press ":x" this will save and come out.

Your pop up reminder is ready.


Solution-2) remind + tkremind

TkRemind is front end GUI for remind. It uses the file ".reminders". I generally prefer to use 'vim' and put up my reminders.

when we type the command 'remind' it reads '.reminders' file. Remind also supports INCLUDE some other file. I prefer to seperate my daily pop-up reminders from anniversary and birthday reminders as by the command 'remind $HOME/remind_main' I get out put of only birthday and anniversary which can be sent as e-mail using cron. It does not look goot to get daily reminders like 'coffee break' 'lunch time reminders' in your mail box, right?

----------------------My .reminders file in $HOME directory--------------

#----------Begining of ".reminders" file---------------

INCLUDE $HOME/remind_main # Contains important birthdays and Anniversary dates

# Moon Phase

REM [trigger(moondate(0))] SPECIAL MOON 0 -1 -1 [moontime(0)]

REM [trigger(moondate(1))] SPECIAL MOON 1 -1 -1 [moontime(1)]

REM [trigger(moondate(2))] SPECIAL MOON 2 -1 -1 [moontime(2)]

REM [trigger(moondate(3))] SPECIAL MOON 3 -1 -1 [moontime(3)]

# Moon Phase End "remind -p .reminders | rem2ps > out.ps"


# Every day Events

# Coffee break reminder this will issue pop-up reminders every 5 minutes between 10.15 - 10.30AM

REM TAG TKTAG1 22 June 2005 *1 AT 10:30 +15 *5 MSG 10.30PM: Wanna Coffee?
# This reminder pops up every 5 minutes between 12.45 PM to 1PM

REM TAG TKTAG2 22 June 2005 *1 AT 13:00 +15 *5 MSG 01.00PM: Lunch Time, Get some Energy man...

#----------End of ".reminders" file---------------



A part of my
remind_main file is here.

#----------Begining of "$HOME/remind_main" file---------------
if !defined("init")
set init 1
fset since(x) ord(year(trigdate())-x)
endif

# Birth Days and Anniversaries

REM 26 Jan +2 msg %"Renuka's [since(1973)]Birthday%" is %b.
REM 27 Feb +2 msg %"Sahitya's[since(2001)]Birthday%" is %b.
REM 28 Feb +2 msg %"Jagadeesh+Nalini's [since(2001)] anniversary%" is %b.

#----------End of "$HOME/remind_main" file---------------



2) Tools needed for e-mail reminder

remind + cron + mail

You can get your remind output in to your mail box with following "cron" entry
45 5 * * 1-7 remind $HOME/remind_main | mail your_ID@domain.com -s "Reminder"

So, every day at 5.45AM remind will be executed and the out put will be sent to your e-mail account with the subject 'Reminder'. This way you can get reminders even while you are travelling!


Final tips/commands:
man cron
man xmessage

man Xdialog
kdialog --help
man mail
man remind

Do you like these linux tips?
Why dont you share your tips?

Comments:
Also check out "gkrellm-reminder" (http://packages.debian.org/unstable/x11/gkrellm-reminder.html)

On debian system "apt-get install gkrellm gkrellm-reminder" should work.
 
I liked you e-mail reminder set up with cron and remind. Thanks for posting it on your blog. Waiting to see more linux tips.
 
nice one. liked it
 
I just couldn't leave your website before saying that I really enjoyed the quality information you offer to your visitors... POP Displays
 
I am a non-windows user. I have followed the below steps and works perfect for me & should for your all.

$ vi .banner.txt --> create a blank & hidden text file in your home or any other directory

$ Please make me remember this task
--> write in that text file & save the file

$ vi .bashrc --> open this file & go to the bottom of this file and write the following

cat /home/user/.banner.txt

--> save the file & close the terminal & you are done! Now whenever you open a fresh new terminal/tab, you would see your tasks getting printed

Thanks
S N Banerjee
 
This is very easy to understand am happy I found your blog, at the same time I was looking for a kdialog scipt to read arp output when a client is connected to my wifi hotspot.

Thankyou.
I am totally new to linux and I am loving it already.
 
What's up, after reading this remarkable paragraph i am as well cheerful to share my knowledge here with mates.
 
Hello very nice blog!! Man .. Excellent .. Wonderful .. I will bookmark your website and take the feeds additionally? I am happy to seek out a lot of useful info right here within the submit, we want develop more strategies in this regard, thank you for sharing. . . . . .
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?