summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-05-11 22:27:23 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-05-11 22:27:23 +0000
commit49419e5a4ffaea93089bdc323cee41b2aaa410d4 (patch)
tree00acb8fd9b5a2c064e474aa6b4d233847631050b
parent63eb59f0bb3b237ff29441a5219d017376f6e2f3 (diff)
New variable VERBOSESTATUS (=1 by default).
When set to 0, daily(8) won't send mail unless there is something to report. Using feedback from kettenis@ henning@ jmc@ OK sthen@ jmc@
-rw-r--r--etc/daily35
-rw-r--r--share/man/man8/daily.814
2 files changed, 31 insertions, 18 deletions
diff --git a/etc/daily b/etc/daily
index 7fc0bcb9e34..ede2bf4d4f4 100644
--- a/etc/daily
+++ b/etc/daily
@@ -1,5 +1,5 @@
#
-# $OpenBSD: daily,v 1.59 2009/05/10 19:27:25 schwarze Exp $
+# $OpenBSD: daily,v 1.60 2009/05/11 22:27:22 schwarze Exp $
# From: @(#)daily 8.2 (Berkeley) 1/25/94
#
umask 022
@@ -11,10 +11,6 @@ MAINOUT=/var/log/daily.out
install -o 0 -g 0 -m 600 /dev/null $PARTOUT
install -o 0 -g 0 -m 600 -b /dev/null $MAINOUT
-exec > $MAINOUT 2>&1
-sysctl -n kern.version
-uptime
-
start_part() {
TITLE=$1
exec > $PARTOUT 2>&1
@@ -110,12 +106,17 @@ next_part "Backing up root filesystem:"
}
}
-next_part "Checking subsystem status:"
-echo ""
-echo "disks:"
-df -kl
-echo ""
-dump W
+next_part "Checking system status:"
+if [ "X$VERBOSESTATUS" != X0 ]; then
+ sysctl -n kern.version
+ uptime
+
+ echo ""
+ echo "disks:"
+ df -kl
+ echo ""
+ dump W
+fi
# The first two regular expressions handle sendmail, the third postfix.
# When the queue is empty, exim -bp keeps silent.
@@ -125,12 +126,14 @@ mailq | grep -v -e "^/var/spool/mqueue is empty$" \
-e "^Mail queue is empty$"
next_part "network:"
-netstat -ivn
+if [ "X$VERBOSESTATUS" != X0 ]; then
+ netstat -ivn
-t=/var/rwho/*
-if [ "$t" != '/var/rwho/*' ]; then
- echo ""
- ruptime
+ t=/var/rwho/*
+ if [ "$t" != '/var/rwho/*' ]; then
+ echo ""
+ ruptime
+ fi
fi
next_part "Running calendar in the background:"
diff --git a/share/man/man8/daily.8 b/share/man/man8/daily.8
index b63e696bfdf..1671bb80fcd 100644
--- a/share/man/man8/daily.8
+++ b/share/man/man8/daily.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: daily.8,v 1.12 2009/05/09 16:29:55 schwarze Exp $
+.\" $OpenBSD: daily.8,v 1.13 2009/05/11 22:27:22 schwarze Exp $
.\"
.\" Copyright (c) 2003 Jason McIntyre <jmc@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 9 2009 $
+.Dd $Mdocdate: May 11 2009 $
.Dt DAILY 8
.Os
.Sh NAME
@@ -219,6 +219,16 @@ Determines whether to run
with the no-write flag.
.It Ev ROOTBACKUP
Determines whether to make a backup of the root file system.
+.It Ev VERBOSESTATUS
+If set to 0,
+.Xr df 1 ,
+.Xr dump 8 ,
+.Xr netstat 1 ,
+and
+.Xr ruptime 1
+are skipped.
+Consequently, if none of the other commands produce any output,
+no mail will be sent to root.
.El
.Pp
The following variables can be set in