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.
no subject
Console idle time? If you're not home, you've probably not been at the computer for a while.
no subject
The biggest issue I see with this isn't technical but how much it costs you to receive the page.
no subject
no subject
That would be a pretty handy use for it. If the gummint can do it, we might as well be able to.
no subject
no subject
no subject
no subject
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.
no subject
no subject
no subject
The big question is cost. Which is more costly, missing the time announcement or receiving the message?
If receiving messages is prohibitively expense(before I had them blocked, they could cost me more than a $1 at times) you could have your computer ring your cellphone twice and hang up.
no subject
is wget using environmental variables from your shell of choice, that aren't available in cron's (sh)? or rely on known proxies or other system antics?
istr that curl can do things wget can't and vice-versa. might be worth a poke.
#
no subject
Yeah. As noted above, when I switched to curl, it just worked.
no subject
I showed him your post, and he said it's firmed up a few more of the ideas he's had on the custom-built widget he's speccing out, so thank you for posting it, even if it was triggered by an irritating event.