Profile

unixronin: Galen the technomage, from Babylon 5: Crusade (Default)
Unixronin

December 2012

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Expand Cut Tags

No cut tags
Monday, January 14th, 2008 08:17 am

Background:

Because I know full well how badly I keep track of time (and how easily I forget things I'm supposed to do), I built myself a reminder scheduler system that reads a calendar of one-time and repeating events from a flat text configuration file.  Each entry contains date or days-of-week, time, time-in-advance, and a list of one or two sounds.  Based on the contents of each entry, schedule calculates the actual clock time for advance reminders (which can be up to seven days in advance), then sets up reminders as at jobs calling a helper program, remind.  For each reminder, remind uses FvwmCommand to pop up a message window with a text reminder, if I'm logged in, and also plays an audio sample whether I'm logged in or not.

(Yes, I've considered also having it page me via a text message to my phone, but I'd have to figure out a way for it to know I'm out of the house.)

Specific application:

Among other things, the schedule file has daily reminders for school bus drop-offs and pickups.  On the present school schedule, I get to drop kids off at the school bus stop to catch two different buses an hour apart, and pick them up from three different buses spread across a four-hour window.  This is all set up in the scheduler to make sure we don't lose track of time and that both I and the kids know when it's getting close to time that they need to be out the door.

The weather factor:

Of course, the watchword here is "snow".  If it snows, or we have other freezing-type adverse weather (freezing rain, for example, which can be bloody dangerous up here "on the mountain"), Gilford schools may remain open, may open late, or may close for the day.  At present, if they open late, it will always be two hours late, though the "always two hours" part is potentially subject to future change.  Also, if the schools open late, morning kindergarten will be cancelled.

Now, these closings or delays are reliably reported online by one of the regional TV stations, WMUR in Manchester.  So, just before Christmas, I wrote another add-on to the scheduler system (called snowscraper) which page-scrapes WMUR's school closings page and, if Gilford schools are delayed or closed, touches one of several possible flag files which the reminder part of the scheduler system uses to skip or reschedule school bus alerts on the fly.  On the chance that schools should be delayed by some period other than two hours, the scraper will detect that and pass the actual delay to remind in the delay flag file.

The problem:

The puzzle was that, while snowscraper was working perfectly when run interactively from an xterm, it was silently failing if run from cron.  It would retrieve the school closings page from WMUR, but without the actual school closing data.  After I finally realized that fact this morning¹, I spent about an hour trying to figure out why it was failing, and couldn't figure out any logical reason.  I was assuming it was something to do with environment, but nothing from my environment that I substituted on the command line seemed to make any difference.  I was already passing all the relevant config options to wget and tidy on the command line.

Just to see if it made a difference, I tried using curl to perform the pagescrape instead of wget. And with that one simple change, suddenly snowscraper worked perfectly from cron.

Go figure...

[1]  Yes, it's been snowing about an inch an hour since about 5am.  But snowscraper didn't trigger until I ran it manually from an xterm.

Tags:
Monday, January 14th, 2008 03:59 pm (UTC)
I was just thinking the same thing. USe something like "xscreensaver-command -watch" to have the machine send a page if the screen has been off for n minutes.

The biggest issue I see with this isn't technical but how much it costs you to receive the page.
Monday, January 14th, 2008 04:04 pm (UTC)
Even that could just mean I'm downstairs watching something on the TV, sitting somewhere reading, or busy elsewhere in the house. In general, there's no reliable mapping between AFK and out of the house.
Monday, January 14th, 2008 04:42 pm (UTC)
I wonder if cellphone GPS units can tell you where you are.

That would be a pretty handy use for it. If the gummint can do it, we might as well be able to.
Monday, January 14th, 2008 05:20 pm (UTC)
There are free tracking applications available for use with GPS-enabled phones. My phone isn't GPS-enabled, though.
Monday, January 14th, 2008 05:45 pm (UTC)
Sounds like it might be worth looking into, when you get your next phone.
Monday, January 14th, 2008 05:52 pm (UTC)
Maybe, but since I'm really not interested in "feature bling" and basically want my phone to just be ... well, a phone, it's likely to be quite some time before I "upgrade".
Monday, January 14th, 2008 06:31 pm (UTC)
Yeah, I'm the same way. My phone just came up for a contract renewal, and the current one is working just fine.

I've often remarked upon an interesting technological conservativism among sysadmin personalities. The first question they ask is, "does it actually add anything to my life?", and if the answer to that is positive, they're all about it - but they're extremely skeptical about arriving at a positive answer to that question.

For instance, the first thing I do when I see a mobile device - I don't know about anyone else - is ask myself, "can this item survive a curbstomping?" Because I KNOW I'm going to drop it, over and over again, over the course of its lifetime. Because I know the core requirements: can it be a phone, and can it survive a beating. Anything else is extra, and if it doesn't fill those qualities, and fill them well, I just won't buy it.

Monday, January 14th, 2008 07:51 pm (UTC)
MY wife's phone has a web browser. What this adds to my life is about $0.40 in bogus charges for data transfers each month