Subject: misc/14825: /etc/{daily,weekly,montly} should be unified
To: None <>
From: None <>
List: netbsd-bugs
Date: 12/03/2001 16:53:24
>Number:         14825
>Category:       misc
>Synopsis:       setting of rebuild_locatedb=YES in daily.conf does not do anything
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 03 06:54:00 PST 2001
>Originator:     Tero Kivinen
>Release:        NetBSD 1.5Y
SSH Communications Security
System: NetBSD 1.5Y NetBSD 1.5Y (KAAKELI) #47: Wed Oct 31 02:45:43 EET 2001 i386
Architecture: i386
Machine: i386

	The /etc/{daily,weekly,montly} scripts should be unified so
	that setting for example rebuild_locatedb=YES in daily.conf
	causes the locatedb to be updated daily. I.e all them should
	run the exactly same script, but the configuration parameters
	simply would be different.


	Currently rebuild_locatedb=YES is only understood by the
	/etc/weekly. Seting it in /etc/daily.conf or /etc/monthly.conf
	does not affect anything.


	Combine all /etc/{daily,weekly,montly} scripts to one having this
	kind of header (not tested):
#!/bin/sh -
#	$NetBSD: oneinawhile,v 1.8 2000/01/10 17:03:49 ad Exp $
#	from: @(#)oneinawhile	8.1 (Berkeley) 6/9/93

export PATH=/bin:/usr/bin:/sbin:/usr/sbin
umask 077

type=`echo $0 | sed 's/.*\///g;'`

if [ -s /etc/$type.conf ]; then
	. /etc/$type.conf

if [ -f /etc/rc.subr ]; then
        . /etc/rc.subr
        echo "Can't read /etc/rc.subr; aborting."
        exit 1;

if checkyesno run_only_when_connected_to_ac; then
        if [ `apm -a` == 0 ]; then
                exit 0


echo "To: ${MAILTO:-root}"
echo "Subject: $host $type output for $date"
echo ""

if [ -z "$MAILTO" -o "$USER" != "root" ]; then


And then all bodies of the /etc/daily, /etc/weekly, and /etc/montly
combined together (removing their headers and footers, and moving some
echo "" and rm -f $TMP $TMP2 etc inside the if checkyesno).

Then the script should have footer like this:
if [ -f /etc/$type.local ]; then
	echo ""
	echo "Running /etc/$type.local:"
	. /etc/$type.local

Then remove /etc/{daily,weekly,montly} and create symlinks from them
to /etc/oneinawhile