Subject: misc/11011: New option to daily/weekly/montly scripts, to stop running if not connected to external power
To: None <gnats-bugs@gnats.netbsd.org>
From: Tero Kivinen <kivinen@ssh.fi>
List: netbsd-bugs
Date: 09/13/2000 15:09:20
>Number:         11011
>Category:       misc
>Synopsis:       New option to daily/weekly/montly scripts
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 13 15:10:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Tero Kivinen
>Release:        NetBSD 1.5 ALPHA2
>Organization:
SSH Communications Security
>Environment:

	NetBSD 1.5 ALPHA 2 on i386.

>Description:

	I have NetBSD on my laptop and it is very annoying to wake the
	system from the hibernation just to check something and
	immediately notice that it starts running daily/weekly/montly
	scripts because it has been suspended for few days. If the
	machine is connected to external power this does not matter,
	but when you are running on batteries you don't want the
	system to start rebuilding the locate database etc.

	To fix this I added new option to
	daily.conf/weekly.conf/montly.conf that will stop running of 
	daily/weekly/montly scripts if I am not connected to external
	power.

>How-To-Repeat:

>Fix:

	The following patch will fix the montly/weekly/daily scripts.

--- /usr/src/etc/monthly	Tue Jan 11 04:10:11 2000
+++ /etc/monthly	Wed Sep 13 16:54:17 2000
@@ -11,6 +11,12 @@
 	. /etc/monthly.conf
 fi
 
+if checkyesno run_only_when_connected_to_ac; then
+	if [ "x`apm -a`" == "x0" ]; then
+		exit 0
+	fi
+fi
+
 host=`hostname`
 date=`date`
 
--- /usr/src/etc/weekly	Tue Jan 11 04:10:11 2000
+++ /etc/weekly	Wed Sep 13 16:54:06 2000
@@ -11,6 +11,12 @@
 	. /etc/weekly.conf
 fi
 
+if checkyesno run_only_when_connected_to_ac; then
+	if [ "x`apm -a`" == "x0" ]; then
+		exit 0
+	fi
+fi
+
 host=`hostname`
 date=`date`
 
--- /usr/src/etc/daily	Fri Aug 25 03:23:21 2000
+++ /etc/daily	Wed Sep 13 16:53:53 2000
@@ -11,6 +11,12 @@
 	. /etc/daily.conf
 fi
 
+if checkyesno run_only_when_connected_to_ac; then
+	if [ "x`apm -a`" == "x0" ]; then
+		exit 0
+	fi
+fi
+
 host=`hostname`
 date=`date`
 
>Release-Note:
>Audit-Trail:
>Unformatted: