#!/usr/bin/perl # Queries one or more Listserv lists for subscribers who have an # option set. Deliberately sends one msg per list; we need separate # answers for subsequent procmail filtering/saving of results. # # Anthony R. Thompson, May 2010 # Contact: put @ between art and sigilservices.com # # Copyright (C) 1998-2010 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. http://www.fsf.org/licensing/licenses/gpl.html $sendmail = '/usr/sbin/sendmail -t'; # INSTALL $sender = 'listowner@yourhost.com'; # INSTALL; list owner $listserv = 'listserv@listhost.com'; # INSTALL $delay = 3; # INSTALL; throttle reqs, if nec $option = uc(shift(@ARGV)); unless ($option and @ARGV) { print "Usage: $0 option listname(s)\n"; exit; } foreach $list (@ARGV) { open(SMAIL, "| $sendmail") || die "Unable to open sendmail at $sendmail\n"; # Subject line is used by procmail filter to save results of query to file print SMAIL "To: $listserv\nFrom: $sender\nSubject: $option query\n\n"; print SMAIL "QUERY $list WITH $option FOR \*\@\*\n"; print "Sent $option query for all addresses on $list\n"; sleep($delay); close(SMAIL); }