From nobody@FreeBSD.org  Thu Feb  5 23:09:12 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 673571065673
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Feb 2009 23:09:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B9138FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Feb 2009 23:09:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n15N9Bau064195
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 5 Feb 2009 23:09:11 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n15N9Bn3064186;
	Thu, 5 Feb 2009 23:09:11 GMT
	(envelope-from nobody)
Message-Id: <200902052309.n15N9Bn3064186@www.freebsd.org>
Date: Thu, 5 Feb 2009 23:09:11 GMT
From: Steven Kreuzer <skreuzer@exit2shell.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add csup to Periodic
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         131438
>Category:       conf
>Synopsis:       [patch] [request] Add csup to Periodic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 05 23:10:01 UTC 2009
>Closed-Date:    Wed Feb 18 17:04:38 UTC 2009
>Last-Modified:  Wed Feb 18 17:04:38 UTC 2009
>Originator:     Steven Kreuzer
>Release:        7.1-PRERELEASE
>Organization:
>Environment:
FreeBSD slurry.exit2shell.com 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #3: Mon Nov 24 14:01:09 EST 2008     root@simon.sddi.net:/usr/obj/usr/src/sys/KERNEL  amd64
>Description:
Rather then run csup each night to update src or ports via an entry in roots crontab I figured it would be cleaner to write a script and add it to periodic so that you can specify a csup file and have its output sent to you via email with the rest of the daily periodic scripts

The attached patch adds support for that but sets it to off by default.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: etc/defaults/periodic.conf
===================================================================
RCS file: /usr/share/cvs/freebsd/src/etc/defaults/periodic.conf,v
retrieving revision 1.47
diff -u -r1.47 periodic.conf
--- etc/defaults/periodic.conf	8 Jan 2008 07:22:43 -0000	1.47
+++ etc/defaults/periodic.conf	5 Feb 2009 22:54:41 -0000
@@ -140,6 +140,9 @@
 daily_queuerun_enable="YES"				# Run mail queue
 daily_submit_queuerun="YES"				# Also submit queue
 
+# 600.csup
+daily_csup_enable="NO"
+
 # 999.local
 daily_local="/etc/daily.local"				# Local scripts
 
Index: etc/periodic/daily/600.csup
===================================================================
RCS file: etc/periodic/daily/600.csup
diff -N etc/periodic/daily/600.csup
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ etc/periodic/daily/600.csup	5 Feb 2009 22:56:35 -0000
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# 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
+
+case "$daily_csup_enable" in
+    [Yy][Ee][Ss])
+	if [ -z "$daily_csup_supfile" ]
+	then
+		echo '$daily_csup_enable is set but' \
+			'$daily_csup_supfile is not'
+		rc=2
+	else
+		if [ -z "$daily_csup_binary" ]
+		then
+			daily_csup_binary=/usr/bin/csup
+		fi
+
+		if [ ! -x "$daily_csup_binary" ]
+		then
+			echo '$daily_csup_binary is set but ' \
+			$daily_csup_binary 'is not executable'
+			rc=2
+		else
+			out=`$daily_csup_binary $daily_csup_supfile`
+			rc=$?
+			echo "$out"
+		fi
+
+	fi;;
+
+    *)  rc=0;;
+esac
+
+exit $rc
Index: etc/periodic/daily/Makefile
===================================================================
RCS file: /usr/share/cvs/freebsd/src/etc/periodic/daily/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- etc/periodic/daily/Makefile	21 Sep 2008 22:02:26 -0000	1.17
+++ etc/periodic/daily/Makefile	5 Feb 2009 22:55:44 -0000
@@ -16,6 +16,7 @@
 	409.status-gconcat \
 	420.status-network \
 	450.status-security \
+	600.csup			\
 	999.local
 
 # NB: keep these sorted by MK_* knobs


>Release-Note:
>Audit-Trail:

From: Maxim Konovalov <maxim@macomnet.ru>
To: Steven Kreuzer <skreuzer@exit2shell.com>
Cc: bug-followup@freebsd.org
Subject: Re: misc/131438: Add csup to Periodic
Date: Sat, 7 Feb 2009 10:34:55 +0300 (MSK)

 Hello Steven,
 
 [...]
 > >Description:
 >
 > Rather then run csup each night to update src or ports via an entry
 > in roots crontab I figured it would be cleaner to write a script and
 > add it to periodic so that you can specify a csup file and have its
 > output sent to you via email with the rest of the daily periodic
 > scripts
 >
 > The attached patch adds support for that but sets it to off by default.
 
 While I like the idea I should note this will hurt our cvsup
 infrastructure world wide.  periodic(8) runs at the same time (3am) on
 all hosts in the same time zone.  That means it'll runs 600.csup at
 same time with some deviation depending of the execution time of the
 previous daily scripts and thus overload local cvsup mirrors.
 
 You can see an illustration for above there:
 
 http://cvsup4.ru.freebsd.org/mrtg/
 
 Please note the spikes of cvsupd number of processes (and therefore
 load average) at 3am at third and fourth graphs every night.  I'm
 quite sure other public cvsup mirrors have an identical load profile.
 
 There is a bit outdated mirror stat page in the Handbook:
 
 http://www.freebsd.org/doc/en_US.ISO8859-1/articles/hubs/mirror-statpages.html
 
 but if you look at
 
 http://www.freebsd.cz/stats/mrtg/cvsupd.html
 
 you will find the same picture I describe above.
 
 -- 
 Maxim Konovalov

From: Steven Kreuzer <skreuzer@exit2shell.com>
To: Maxim Konovalov <maxim@macomnet.ru>
Cc: bug-followup@freebsd.org
Subject: Re: misc/131438: Add csup to Periodic
Date: Wed, 18 Feb 2009 09:47:55 -0500

 On Feb 7, 2009, at 2:34 AM, Maxim Konovalov wrote:
 
 > Hello Steven,
 >
 > [...]
 >>> Description:
 >>
 >> Rather then run csup each night to update src or ports via an entry
 >> in roots crontab I figured it would be cleaner to write a script and
 >> add it to periodic so that you can specify a csup file and have its
 >> output sent to you via email with the rest of the daily periodic
 >> scripts
 >>
 >> The attached patch adds support for that but sets it to off by  
 >> default.
 >
 > While I like the idea I should note this will hurt our cvsup
 > infrastructure world wide.  periodic(8) runs at the same time (3am) on
 > all hosts in the same time zone.  That means it'll runs 600.csup at
 > same time with some deviation depending of the execution time of the
 > previous daily scripts and thus overload local cvsup mirrors.
 
 Hi Maxim-
 
 Thats a pretty good point that I didn't take into consideration when I  
 was writing this.
 You can close this PR.
 
 Thanks
 
 --
 Steven Kreuzer
 http://www.exit2shell.com/~skreuzer
 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Wed Feb 18 17:04:28 UTC 2009 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131438 
>Unformatted:
