[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pseudo-useful add-on for the kernelver script
Hello,
I was all excited when I read that I could get mail whenever finger
@www.kernel.org changes, but to my dismay the script didn't send mail it
just spit out `finger @www.kernel.org` when @www.kernel.org changed. So I
made an add-on that e-mails me with the new version in the subject line
and the finger information in the body. I hope that this is useful to
somebody.
#!/usr/bin/perl
# FILENAME: KernelAlert.pl
# VERSION: 1.0
# INITIAL DATE: 2002-12-08
# LAST CHANGE: 2002-12-08
# PROGRAMMER: Thomas Cort <tcort@cort.ws>
# LICENSE: MIT
# COPYRIGHT: (c) 2002 Thomas Cort
# DESCRIPTION: Send an e-mail if a new kernel or patch is out
#
# HOW-TO-USE: Step 1) Download kernelver from:
# http://www.kernelnewbies.org/scripts/kernelver
# Step 2) Place kernelver and this file in the same directory
# Step 3) Replace line 23 of kernelver with:
# KernelAlert.pl
# Step 4) Change the USER DEFINE VARIABLES below
# Step 5) Make sure kernelver & KernelAlert.pl are executable
# Step 6) Check the path to perl. Line 1 of this file
# Step 7) Periodically call kernelver from a cronjob
#
## USER DEFINED VARIABLES ##
$email_address = "tcort\@cort.ws";
$path_to_sendmail = "/usr/bin";
## END USER DEFINED VARIABLES ##
# Open diff file. If a line has "+T" copy the string from character 60 to
# character 80 and put the copy in $updated_kernel. Close diff file.
open(DIFF,".kv.diff");
while (<DIFF>) {
if (/\+T/) {
$updated_kernel = substr($_,60,80);
}
}
close(DIFF);
# Set the message subject
$subject = "Subject: Kernel Alert:$updated_kernel\n\n";
# Open sendmail and start a mail to $email_address w/a subject of $subject
open(MAIL,"|$path_to_sendmail/sendmail $email_address");
print MAIL "$subject";
# copy the new finger information into the e-mail
open(KV,".kv.new");
while (<KV>) { print MAIL "$_"; }
close(KV);
# send and close the e-mail
print MAIL "\n\n.\n";
close(MAIL);
exit;
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/