54 lines
2.2 KiB
Markdown
54 lines
2.2 KiB
Markdown
+++
|
||
date = "2008-11-19T17:11:00-07:00"
|
||
title = "Alerting with Remind"
|
||
categories = ["software"]
|
||
tags = ["cli"]
|
||
+++
|
||
|
||
Alerting with Remind
|
||
====================
|
||
|
||
Back in my [article on Remind](links://slug/so-you-need-a-calendar/), I
|
||
talked about the simple power of remind to power your scheduling needs.
|
||
That is all fine and good, but how to you get it to tell you when you
|
||
have an event?
|
||
|
||
In its simplest form, when you run _remind_ from the command line, it
|
||
will not only display the current day's reminders, but it will run in
|
||
the background and wake up to tell you about other reminders on the
|
||
screen while you work.
|
||
|
||
This is fine, but what happens if you do not have that termial open in
|
||
front of you? Well, I have two ways I approach that issue.
|
||
|
||
First, when I run under X ([yeah, yeah, I know, but I use cli tools
|
||
under X](links://slug/what-do-i-use/)), I have this added to my
|
||
.xinitrc:
|
||
|
||
> remind -z -k'xmessage -buttons okay:0 -default okay %s&' \~/.reminders
|
||
> &
|
||
|
||
Let's look at the command line:
|
||
|
||
- The **-z** tells remind to wake up every 5 minutes and reread the
|
||
.reminders file.
|
||
- The **-k** tells remind to run a command instead of simply printing
|
||
the reminder to the screen
|
||
- **xmessage -buttons okay:0 -default okay %s&** is the secret sauce
|
||
of this. This is the command run when there is an alarm. This
|
||
command line calls xmessage (which is on pretty much any box with X)
|
||
to display the alert. You could use zenity or kmessage, or
|
||
winpopup, or whatever. This is what puts the alert in your face
|
||
when you are not looking at the screen. The **&** is needed to make
|
||
this command non-blocking by putting it in the background.
|
||
|
||
That all good if you are setting at your computer. But, what do you do
|
||
when *gasp* you leave to computer? This is a little tricker. For this,
|
||
my solution needs two things: 1) a computer which is always on and 2) a
|
||
way to send messages to your cell phone/pager (sms or email). I have a
|
||
cron job which checks to make sure remind is running, and restarts it if
|
||
it is not (I use a hosting provider which does not like long running
|
||
processes). The command line is similar to the one for X, but with a
|
||
difference:
|
||
|
||
> TZ=CDT6CST \~/bin/remind -z -k"echo %s
|