Mac GeekeryGet your geek on. |
|
blog advertising is good for you
recent popular content
User login
|
QuestionHow could one setup an RSS feed of various network events? Ideally the feed would: AnswerYou’ll want to write scripts to gather the information you need, then log that information, and then convert that log to RSS. Happily, most of this is already done for you. We can use one of the various local facilities for this purpose. They range from local7.* /var/log/events Then HUP syslogd to activate the new log: sudo killall -HUP syslogd Test with the following command, which should put a log line in /var/log/events: logger -p local7.notice foo Now you’ll need to setup a script like the following to do the testing, logging on failures:
#!/bin/bash
if ! ping -o bob.local
then
logger -p local7.notice Could not contact bob.local
fi
Set that to run periodically with cron or launchd or whatnot. Then, at some interval, run the log2rss.pl script we covered previously on the /var/log/events log and then publish and subscribe to that RSS feed (either locally, or by saving to someone’s Sites folder and using Personal Web Sharing). Voila, a feed of system events that you control.
About Adam Knight
Author Biography Adam Knight is one of the founders of Mac Geekery and is a geek at heart. Programmer by day, hacker by night, his daily life revolves around the Macintosh platform, which he has been a user and programmer for since the early days of System 7 when his LCII replaced his Apple //c. In-between tech jobs, he’s managed to learn the basics of any web hacker: PHP, MySQL, Perl, Apache, Linux, *BSD, and the intricacies of ./configure —prefix=~/bombshelter/. Today, codepoet is concentrating on blogging again, writing some software for the Mac by himself (including Notae) and for his company (such as Switchblade) and has a few other toys coming out soon. Bug him over AIM or email [link fixed].
Post new comment
|