aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Osipov <michaelo@FreeBSD.org>2023-11-24 09:26:41 +0000
committerMichael Osipov <michaelo@FreeBSD.org>2024-01-30 11:44:14 +0000
commit4c14a3a6aebe94d61da00c2dac2ef4bb2d9a2b3b (patch)
treea5442cc5512038a9fc4ca5807aac8c3247e329bb
parent6455c2cf85a920577dfe6bced32f97d9216abc73 (diff)
downloadsrc-4c14a3a6aebe.tar.gz
src-4c14a3a6aebe.zip
periodic: Make daily diff(1) output as small is possible
Make, by default, daily diff(1) ignore whitespace changes and the unified output a context of zero (0) lines. This reduces output of unrelated lines in e-mails delivered to root. PR: 270266 Approved by: jrm (mentor), karels MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D42762 (cherry picked from commit e2f6bafc3887c7752986526f3758525d24701fce)
-rw-r--r--share/man/man5/periodic.conf.53
-rwxr-xr-xusr.sbin/periodic/etc/daily/200.backup-passwd4
-rwxr-xr-xusr.sbin/periodic/etc/daily/210.backup-aliases2
-rw-r--r--usr.sbin/periodic/periodic.conf2
4 files changed, 7 insertions, 4 deletions
diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5
index 1edc8bf14767..ab13ad7c2b66 100644
--- a/share/man/man5/periodic.conf.5
+++ b/share/man/man5/periodic.conf.5
@@ -650,6 +650,9 @@ All scripts must be absolute path names.
Set to the arguments to pass to the
.Xr diff 1
utility when generating differences.
+The default is
+.Fl b
+.Fl U Cm 0 .
.El
.Pp
The following variables are used by the standard scripts that reside in
diff --git a/usr.sbin/periodic/etc/daily/200.backup-passwd b/usr.sbin/periodic/etc/daily/200.backup-passwd
index e165e7f0f0ed..7cd52fc7be4b 100755
--- a/usr.sbin/periodic/etc/daily/200.backup-passwd
+++ b/usr.sbin/periodic/etc/daily/200.backup-passwd
@@ -40,7 +40,7 @@ case "$daily_backup_passwd_enable" in
then
[ $rc -lt 1 ] && rc=1
echo "$host passwd diffs:"
- diff ${daily_diff_flags:--u} -I '^#' $bak/master.passwd.bak /etc/master.passwd |\
+ diff ${daily_diff_flags} -I '^#' $bak/master.passwd.bak /etc/master.passwd |\
sed 's/^\([-+ ][^:]*\):[^:]*:/\1:(password):/'
mv $bak/master.passwd.bak $bak/master.passwd.bak2
cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3
@@ -57,7 +57,7 @@ case "$daily_backup_passwd_enable" in
then
[ $rc -lt 1 ] && rc=1
echo "$host group diffs:"
- diff ${daily_diff_flags:--u} $bak/group.bak /etc/group
+ diff ${daily_diff_flags} $bak/group.bak /etc/group
mv $bak/group.bak $bak/group.bak2
cp -p /etc/group $bak/group.bak || rc=3
fi
diff --git a/usr.sbin/periodic/etc/daily/210.backup-aliases b/usr.sbin/periodic/etc/daily/210.backup-aliases
index 25e2bd021a84..d236d9615dba 100755
--- a/usr.sbin/periodic/etc/daily/210.backup-aliases
+++ b/usr.sbin/periodic/etc/daily/210.backup-aliases
@@ -34,7 +34,7 @@ case "$daily_backup_aliases_enable" in
then
[ $rc -lt 1 ] && rc=1
echo "$host aliases diffs:"
- diff ${daily_diff_flags:--u} $bak/aliases.bak /etc/mail/aliases
+ diff ${daily_diff_flags} $bak/aliases.bak /etc/mail/aliases
mv $bak/aliases.bak $bak/aliases.bak2
cp -p /etc/mail/aliases $bak/aliases.bak || rc=3
fi
diff --git a/usr.sbin/periodic/periodic.conf b/usr.sbin/periodic/periodic.conf
index 6f52f3f1aacf..9fc2ad3af0d0 100644
--- a/usr.sbin/periodic/periodic.conf
+++ b/usr.sbin/periodic/periodic.conf
@@ -31,7 +31,7 @@ anticongestion_sleeptime=3600
# that output. $daily_output might be set to /var/log/daily.log if you
# wish to log the daily output and have the files rotated by newsyslog(8)
#
-daily_diff_flags="" # flags for diff output
+daily_diff_flags="-b -U 0" # flags for diff output
daily_output="root" # user or /file
daily_show_success="YES" # scripts returning 0
daily_show_info="YES" # scripts returning 1