From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Sep 9 10:30:02 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C61B1065677 for ; Tue, 9 Sep 2008 10:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DEC768FC0A for ; Tue, 9 Sep 2008 10:30:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m89AU1TR050772 for ; Tue, 9 Sep 2008 10:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m89AU19x050771; Tue, 9 Sep 2008 10:30:01 GMT (envelope-from gnats) Resent-Date: Tue, 9 Sep 2008 10:30:01 GMT Resent-Message-Id: <200809091030.m89AU19x050771@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jeremy Chadwick Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA4E7106566C for ; Tue, 9 Sep 2008 10:24:09 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from QMTA08.westchester.pa.mail.comcast.net (qmta08.westchester.pa.mail.comcast.net [76.96.62.80]) by mx1.freebsd.org (Postfix) with ESMTP id 5B52F8FC13 for ; Tue, 9 Sep 2008 10:24:09 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from OMTA14.westchester.pa.mail.comcast.net ([76.96.62.60]) by QMTA08.westchester.pa.mail.comcast.net with comcast id CaGk1a0081HzFnQ58aQ8Zd; Tue, 09 Sep 2008 10:24:08 +0000 Received: from koitsu.dyndns.org ([67.180.253.227]) by OMTA14.westchester.pa.mail.comcast.net with comcast id CaQ71a0024v8bD73aaQ7la; Tue, 09 Sep 2008 10:24:08 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id B4C7317B84E; Tue, 9 Sep 2008 03:24:06 -0700 (PDT) Message-Id: <20080909102406.B4C7317B84E@icarus.home.lan> Date: Tue, 9 Sep 2008 03:24:06 -0700 (PDT) From: Jeremy Chadwick To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: scheidell@secnap.net Subject: ports/127242: Add nightly periodic(8) script that uses sa-update X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jeremy Chadwick List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2008 10:30:02 -0000 >Number: 127242 >Category: ports >Synopsis: Add nightly periodic(8) script that uses sa-update >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Sep 09 10:30:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Jeremy Chadwick >Release: FreeBSD 7.1-PRERELEASE amd64 >Organization: >Environment: System: FreeBSD icarus.home.lan 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Tue Sep 2 00:14:39 PDT 2008 root@icarus.home.lan:/usr/obj/usr/src/sys/PDSMI_PLUS_amd64 amd64 >Description: It would be convenient if we have a periodic(8) script that ran sa-update nightly, allowing new rules to be downloaded automatically. >How-To-Repeat: n/a >Fix: Below is the script. Note that the hard-coded /usr/local paths will need to be changed to %%WHATEVER%% and expanded. (I'm being somehwat lazy tonight, otherwise I'd include a full diff/patch for the port Makefile and related stuffs) periodic flags used are fairly self-descriptive. :-) #!/bin/sh -f # # $FreeBSD$ # # periodic(8) script that runs sa-update on a nightly basis, updating # SpamAssassin rules if needed. Relies on sa-update command. # # Contributed by: Jeremy Chadwick # # Define these variables in either /etc/periodic.conf or # /etc/periodic.conf.local to override the defaults. # # Examples: # # saupdate_enable="YES" # run sa-update(1) daily # saupdate_flags="--nogpg" # flags passed to sa-update, e.g. disable GPG support # saupdate_restart_spamd="YES" # Restart sa-spamd when new rules are found # If there is a global system configuration file, suck it in. # if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf source_periodic_confs fi : ${saupdate_enable="NO"} : ${saupdate_flags=""} : ${saupdate_restart_spamd="YES"} rc=0 case "$saupdate_enable" in [Yy][Ee][Ss]) echo echo "Running sa-update:" echo /usr/local/bin/sa-update ${saupdate_flags} || rc=$? if [ $rc -eq 0 ]; then echo "Downloaded and installed new rules." echo case "$saupdate_restart_spamd" in [Yy][Ee][Ss]) echo "Restarting sa-spamd:" echo /usr/local/etc/rc.d/sa-spamd restart ;; *) ;; esac elif [ $rc -eq 1 ]; then echo "No new rules available." rc=0 else echo "sa-update failed with exit code $rc. Please refer to the sa-update(1)" echo "man page for details." fi ;; *) rc=0 ;; esac exit $rc >Release-Note: >Audit-Trail: >Unformatted: