[ILUG] Slashdot New Story Notifier ;)

From: McDaid, Aaron (Aaron.McDaid at domain compaq.com)
Date: Wed 03 May 2000 - 17:03:49 IST


Thought some of you might like this:
Should I GPL it ;) Maybe I could generalize it
to check a few others sites (including kuro5hin.org,
segfault.org etc.)
It's a bit messy but then again I don't claim to
be a shell scripting expert (I'll have a look at
http://www.linuxnewbie.org/nhf/intel/programming/introbashscript.html
mentioned in recent days)

#!/bin/bash
cd ~hoss10/checkslash
cp new old
wget -O - slashdot.org|./firststory.pl>new
if (test ! -s new) then
  cp old new
fi
if !(diff new old) then
  cat new|smbclient -M dcsu_2000
fi

It's run by cron every 5 minutes on a Linux machine
in a server room here in work. It there's been a
new story since the last time it ran it uses
smbclient (part of samba) to pop a message on any/most
Windows boxes. ie. my win2k box

The firststory.pl is a perl script that reads the
first story title from STDIN and puts it on STDOUT

The first if statement is in case there was an error,
which would leave new empty and then notify me about
the same story twice!

Saves me refreshing www.slashdot.org every 5 minutes
when I'm bored



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:00 GMT