Simple CLI reminder

Here is a simple one liner to aid you in remembering certain tasks you need to complete. This command will create a popup on screen (tested using Debian based distros) as a reminder to complete the job assigned;

echo "DISPLAY=$DISPLAY xmessage remember to reset account ips" | at 03:00

In the command (echo “DISPLAY=$DISPLAY xmessage remember to reset account ips” | at 03:00) the message follows the xmessage command. The “remember to reset account ips” is where the message you wish to relate will appear.
The “at 03:00” will need to modified to fit the desired time frame in which the task is to be started.

The “at” can also be changed to reflect the number of hours in which the reminder is due, for example;

Time:
Format hh:mm. am / pm : 07:30 am
Format Military time : 0357 or 1542 (3:57am or 3:57pm)
midnight – Indicates the time 12:00 am (00:00).
noon – Indicates the time 12:00 pm.

Date:
Format month, date, year
today – Indicates the current day.
tomorrow – Indicates the day following the current day

The response you should get if the command was successfully acepted is;
warning: commands will be executed using /bin/sh
job 1 at Sat Dec 12 22:30:00 2009

This reminder command can also be setup as a crontab to remind you of a daily reoccurring event. You will need to put the reminder in a file and chmod+x the file in order to make it executable so crontab can run it.

touch /root/reminder.sh

vim /root/reminder.sh

insert reminder command into file /root/reminder.sh

#!/bin/bash
echo "DISPLAY=$DISPLAY xmessage remember to reset account ips" | at 03:00

then save and close the file with “:wq”

chmod +x  /root/reminder.sh

Then modify the crontab file with the new cron;

crontab -e

0 1 * * * /root/reminder.sh
(this will set the reminder to everyday at 0100)

0 */8 * * * /root/reminder.sh
(this will set the reminder to every 8 hours 0000, 0800 and 1600)

If you would like a confirmation button to send an email when the task has been accepted, simply modify the script to include the following;

========================================
#!/bin/sh
# reminder and email confirmation
#uses xmessage to ask first.
echo “DISPLAY=$DISPLAY answer=$ xmessage remember to reset account ips” -buttons yes,no -print | at 2251
if [ $answer = “yes” ]
then
# mailing confirmation of completed reminder.
mail -s “Reminder Completed” user_name@email_address.com
fi
=========================================

(Note: The “mail -s” function will need sendmail to be installed on the local box where the command is run )

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.