Re: Make df output more human friendly in daily(8)

2020-10-03 Thread Daniel Jakots
On Sat, 3 Oct 2020 13:53:13 +0100, Stuart Henderson
 wrote:

> > +next_part "Backing up filesystems with dump:"
> > +dump w | grep -vB1 ^Dump  
> 
> The "next_part" header text is wrong, it isn't doing a backup here,
> it's only reporting which need to be dumped.

Thanks! Here's a version with
+next_part "Filesystems which need to be dumped:"

Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.93
diff -u -p -r1.93 daily
--- etc/daily   9 Sep 2019 20:02:26 -   1.93
+++ etc/daily   3 Oct 2020 21:13:25 -
@@ -136,21 +136,8 @@ done
 next_part "Services that should be running but aren't:"
 rcctl ls failed
 
-next_part "Checking subsystem status:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   echo ""
-   echo "disks:"
-   df -ikl
-   echo ""
-   dump W
-else
-   dump w | grep -vB1 ^Dump
-fi
-
-next_part "network:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   netstat -ivn
-fi
+next_part "Filesystems which need to be dumped:"
+dump w | grep -vB1 ^Dump
 
 next_part "Running calendar in the background:"
 if [ "X$CALENDAR" != X0 -a \
Index: share/man/man8/daily.8
===
RCS file: /cvs/src/share/man/man8/daily.8,v
retrieving revision 1.28
diff -u -p -r1.28 daily.8
--- share/man/man8/daily.8  26 Jul 2020 13:27:24 -  1.28
+++ share/man/man8/daily.8  3 Oct 2020 21:13:25 -
@@ -114,15 +114,9 @@ Lists any daemons which are enabled in
 .Xr rc.conf.local 8
 but which are not actually running.
 .It
-Checks disk status.
-Reports on the amount of disk used/available via
-.Xr df 1 .
 Reports on which file systems need to be dumped via
 .Xr dump 8 .
 .It
-Reports networking statistics via
-.Xr netstat 1 .
-.It
 Runs the
 .Xr calendar 1
 utility unless the environment variable
@@ -205,15 +199,6 @@ If set to 1, run
 with the no-write flag.
 .It Ev ROOTBACKUP
 If set to 1, make a backup of the root file system.
-.It Ev VERBOSESTATUS
-If set to 0,
-.Xr df 1 ,
-.Xr dump 8 ,
-and
-.Xr netstat 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
@@ -250,9 +235,7 @@ Root
 .Sh SEE ALSO
 .Xr calendar 1 ,
 .Xr crontab 1 ,
-.Xr df 1 ,
 .Xr locate 1 ,
-.Xr netstat 1 ,
 .Xr rdist 1 ,
 .Xr whatis 1 ,
 .Xr crontab 5 ,
Index: share/man/man8/afterboot.8
===
RCS file: /cvs/src/share/man/man8/afterboot.8,v
retrieving revision 1.165
diff -u -p -r1.165 afterboot.8
--- share/man/man8/afterboot.8  9 Feb 2020 16:36:02 -
1.165 +++ share/man/man8/afterboot.83 Oct 2020 21:13:25 -
@@ -458,8 +458,6 @@ to understand what the periodic system m
 how to customize them:
 For example, to enable
 .Ev ROOTBACKUP
-or to disable
-.Ev VERBOSESTATUS ,
 or to add local maintenance code to
 .Pa /etc/daily.local , /etc/weekly.local ,
 or



Re: Make df output more human friendly in daily(8)

2020-10-03 Thread Craig Skinner
Hi Daniel/Ingo,

On Fri, 2 Oct 2020 15:41:31 -0400 Daniel Jakots wrote:
> +next_part "Backing up filesystems with dump:"
> +dump w | grep -vB1 ^Dump

That command doesn't dump disks. w shows the operator what to dump.

Cheers,
Craig.



Re: Make df output more human friendly in daily(8)

2020-10-03 Thread Stuart Henderson
On 2020/10/03 08:44, Daniel Jakots wrote:
> On Sat, 3 Oct 2020 08:00:44 +0200, Ingo Schwarze 
> wrote:
> 
> > But this needs to remain:
> > 
> > > -Reports on which file systems need to be dumped via
> > > -.Xr dump 8 .
> > > -.It  
> 
> Indeed, I wrongly assumed that the other dump call was silent. Here's
> the updated diff:

> -if [ "X$VERBOSESTATUS" != X0 ]; then
> - netstat -ivn
> -fi
> +next_part "Backing up filesystems with dump:"
> +dump w | grep -vB1 ^Dump

The "next_part" header text is wrong, it isn't doing a backup here,
it's only reporting which need to be dumped.



Re: Make df output more human friendly in daily(8)

2020-10-03 Thread Daniel Jakots
On Sat, 3 Oct 2020 08:00:44 +0200, Ingo Schwarze 
wrote:

> But this needs to remain:
> 
> > -Reports on which file systems need to be dumped via
> > -.Xr dump 8 .
> > -.It  

Indeed, I wrongly assumed that the other dump call was silent. Here's
the updated diff:


Index: share/man/man8/daily.8
===
RCS file: /cvs/src/share/man/man8/daily.8,v
retrieving revision 1.28
diff -u -p -r1.28 daily.8
--- share/man/man8/daily.8  26 Jul 2020 13:27:24 -  1.28
+++ share/man/man8/daily.8  3 Oct 2020 12:40:12 -
@@ -114,15 +114,9 @@ Lists any daemons which are enabled in
 .Xr rc.conf.local 8
 but which are not actually running.
 .It
-Checks disk status.
-Reports on the amount of disk used/available via
-.Xr df 1 .
 Reports on which file systems need to be dumped via
 .Xr dump 8 .
 .It
-Reports networking statistics via
-.Xr netstat 1 .
-.It
 Runs the
 .Xr calendar 1
 utility unless the environment variable
@@ -205,15 +199,6 @@ If set to 1, run
 with the no-write flag.
 .It Ev ROOTBACKUP
 If set to 1, make a backup of the root file system.
-.It Ev VERBOSESTATUS
-If set to 0,
-.Xr df 1 ,
-.Xr dump 8 ,
-and
-.Xr netstat 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
@@ -250,9 +235,7 @@ Root
 .Sh SEE ALSO
 .Xr calendar 1 ,
 .Xr crontab 1 ,
-.Xr df 1 ,
 .Xr locate 1 ,
-.Xr netstat 1 ,
 .Xr rdist 1 ,
 .Xr whatis 1 ,
 .Xr crontab 5 ,
Index: share/man/man8/afterboot.8
===
RCS file: /cvs/src/share/man/man8/afterboot.8,v
retrieving revision 1.165
diff -u -p -r1.165 afterboot.8
--- share/man/man8/afterboot.8  9 Feb 2020 16:36:02 -
1.165 +++ share/man/man8/afterboot.83 Oct 2020 12:40:12 -
@@ -458,8 +458,6 @@ to understand what the periodic system m
 how to customize them:
 For example, to enable
 .Ev ROOTBACKUP
-or to disable
-.Ev VERBOSESTATUS ,
 or to add local maintenance code to
 .Pa /etc/daily.local , /etc/weekly.local ,
 or
Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.93
diff -u -p -r1.93 daily
--- etc/daily   9 Sep 2019 20:02:26 -   1.93
+++ etc/daily   3 Oct 2020 12:40:12 -
@@ -136,21 +136,8 @@ done
 next_part "Services that should be running but aren't:"
 rcctl ls failed
 
-next_part "Checking subsystem status:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   echo ""
-   echo "disks:"
-   df -ikl
-   echo ""
-   dump W
-else
-   dump w | grep -vB1 ^Dump
-fi
-
-next_part "network:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   netstat -ivn
-fi
+next_part "Backing up filesystems with dump:"
+dump w | grep -vB1 ^Dump
 
 next_part "Running calendar in the background:"
 if [ "X$CALENDAR" != X0 -a \



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Ingo Schwarze
Hi Daniel,

my OK still stands, except that you went too far in one respect
in the manual page, see below.

Yours,
  Ingo


Daniel Jakots wrote on Fri, Oct 02, 2020 at 03:41:31PM -0400:

> Index: share/man/man8/daily.8
> ===
> RCS file: /cvs/src/share/man/man8/daily.8,v
> retrieving revision 1.28
> diff -u -p -r1.28 daily.8
> --- share/man/man8/daily.826 Jul 2020 13:27:24 -  1.28
> +++ share/man/man8/daily.82 Oct 2020 19:34:47 -
> @@ -114,15 +114,6 @@ Lists any daemons which are enabled in
>  .Xr rc.conf.local 8
>  but which are not actually running.
>  .It
> -Checks disk status.
> -Reports on the amount of disk used/available via
> -.Xr df 1 .

So far, so good.

But this needs to remain:

> -Reports on which file systems need to be dumped via
> -.Xr dump 8 .
> -.It

>From here on, deletion is OK again.

> -Reports networking statistics via
> -.Xr netstat 1 .
> -.It
>  Runs the
>  .Xr calendar 1
>  utility unless the environment variable
> @@ -205,15 +196,6 @@ If set to 1, run
>  with the no-write flag.
>  .It Ev ROOTBACKUP
>  If set to 1, make a backup of the root file system.
> -.It Ev VERBOSESTATUS
> -If set to 0,
> -.Xr df 1 ,
> -.Xr dump 8 ,
> -and
> -.Xr netstat 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
> @@ -250,9 +232,7 @@ Root
>  .Sh SEE ALSO
>  .Xr calendar 1 ,
>  .Xr crontab 1 ,
> -.Xr df 1 ,
>  .Xr locate 1 ,
> -.Xr netstat 1 ,
>  .Xr rdist 1 ,
>  .Xr whatis 1 ,
>  .Xr crontab 5 ,



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Daniel Jakots
On Fri, 2 Oct 2020 22:47:43 +0200, Klemens Nanni  wrote:

> That is OK with me, but you need to remove all mentions:
> 
>   $ man -k any=VERBOSESTATUS
>   afterboot(8) - things to check after the first complete boot
>   daily, monthly, weekly(8) - periodic system maintenance

Indeed, thanks!

Here's the afterboot.8 diff:

Index: share/man/man8/afterboot.8
===
RCS file: /cvs/src/share/man/man8/afterboot.8,v
retrieving revision 1.165
diff -u -p -r1.165 afterboot.8
--- share/man/man8/afterboot.8  9 Feb 2020 16:36:02 -   1.165
+++ share/man/man8/afterboot.8  2 Oct 2020 21:00:24 -
@@ -458,8 +458,6 @@ to understand what the periodic system m
 how to customize them:
 For example, to enable
 .Ev ROOTBACKUP
-or to disable
-.Ev VERBOSESTATUS ,
 or to add local maintenance code to
 .Pa /etc/daily.local , /etc/weekly.local ,
 or



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Klemens Nanni
On Fri, Oct 02, 2020 at 03:41:31PM -0400, Daniel Jakots wrote:
> On Fri, 2 Oct 2020 21:04:20 +0200, Ingo Schwarze 
> wrote:
> 
> > I certainly like this, and it works for me.
> > 
> > But i think a change like this would need more than one OK,
> > and you should wait some days such that developers can raise
> > objections.
> 
> Yes, of course.
> 
> > Just in case you get sufficient OKs and there are no serious
> > objections, see below for two suggested tweaks.
> 
> Thanks for the help!
That is OK with me, but you need to remove all mentions:

$ man -k any=VERBOSESTATUS
afterboot(8) - things to check after the first complete boot
daily, monthly, weekly(8) - periodic system maintenance



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Daniel Jakots
On Fri, 2 Oct 2020 21:04:20 +0200, Ingo Schwarze 
wrote:

> I certainly like this, and it works for me.
> 
> But i think a change like this would need more than one OK,
> and you should wait some days such that developers can raise
> objections.

Yes, of course.

> Just in case you get sufficient OKs and there are no serious
> objections, see below for two suggested tweaks.

Thanks for the help!

Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.93
diff -u -p -r1.93 daily
--- etc/daily   9 Sep 2019 20:02:26 -   1.93
+++ etc/daily   2 Oct 2020 19:34:47 -
@@ -136,21 +136,8 @@ done
 next_part "Services that should be running but aren't:"
 rcctl ls failed
 
-next_part "Checking subsystem status:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   echo ""
-   echo "disks:"
-   df -ikl
-   echo ""
-   dump W
-else
-   dump w | grep -vB1 ^Dump
-fi
-
-next_part "network:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   netstat -ivn
-fi
+next_part "Backing up filesystems with dump:"
+dump w | grep -vB1 ^Dump
 
 next_part "Running calendar in the background:"
 if [ "X$CALENDAR" != X0 -a \
Index: share/man/man8/daily.8
===
RCS file: /cvs/src/share/man/man8/daily.8,v
retrieving revision 1.28
diff -u -p -r1.28 daily.8
--- share/man/man8/daily.8  26 Jul 2020 13:27:24 -  1.28
+++ share/man/man8/daily.8  2 Oct 2020 19:34:47 -
@@ -114,15 +114,6 @@ Lists any daemons which are enabled in
 .Xr rc.conf.local 8
 but which are not actually running.
 .It
-Checks disk status.
-Reports on the amount of disk used/available via
-.Xr df 1 .
-Reports on which file systems need to be dumped via
-.Xr dump 8 .
-.It
-Reports networking statistics via
-.Xr netstat 1 .
-.It
 Runs the
 .Xr calendar 1
 utility unless the environment variable
@@ -205,15 +196,6 @@ If set to 1, run
 with the no-write flag.
 .It Ev ROOTBACKUP
 If set to 1, make a backup of the root file system.
-.It Ev VERBOSESTATUS
-If set to 0,
-.Xr df 1 ,
-.Xr dump 8 ,
-and
-.Xr netstat 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
@@ -250,9 +232,7 @@ Root
 .Sh SEE ALSO
 .Xr calendar 1 ,
 .Xr crontab 1 ,
-.Xr df 1 ,
 .Xr locate 1 ,
-.Xr netstat 1 ,
 .Xr rdist 1 ,
 .Xr whatis 1 ,
 .Xr crontab 5 ,



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Ingo Schwarze
Hi Daniel,

Daniel Jakots wrote on Fri, Oct 02, 2020 at 02:16:57PM -0400:
> On Fri, 2 Oct 2020 19:55:53 +0200, Ingo Schwarze wrote:
>> Daniel Jakots wrote on Thu, Oct 01, 2020 at 10:32:31PM -0400:

>>> Currently daily(8) runs `df -ikl`.  

>> By default, it does not.  It only does that if you set VERBOSESTATUS.

> Are you sure? It looks like it does not, *if* you set VERBOSESTATUS to
> 0. (And that's what daily(8) says as well).

Sorry for misremebering this and for not checking it before i posted.
You are right.

>> I would prefer deleting the VERBOSESTATUS parts completely,
>> strictly enforcing the principle "daily(8) only produces output
>> when something unexpected happens", and tell people to use
>> daily.local(8) if they want to run df or netstat.  The code
>> for those two parts is totally trivial and riddled with
>> choices that look like personal preferences, like the one
>> you suggest to change.

> I agree, that would a better change indeed. I think I'll fix my
> problem by setting VERBOSESTATUS to 0 and add what I want to my
> daily.local.
 
>> I dimly remember that some developers wanted to keep VERBOSESTATUS,
>> though (i might misremember), so we'll probably keep it.  If we
>> keep it, i absolutely don't care what it does.  So i'll neither OK
>> this nor object to it.

> Anyone cares about this one way or the other? Here's a diff for it. (If
> we want to go this way, I'll craft a diff for current.html as well).

I certainly like this, and it works for me.

But i think a change like this would need more than one OK,
and you should wait some days such that developers can raise
objections.

Just in case you get sufficient OKs and there are no serious
objections, see below for two suggested tweaks.

Yours,
  Ingo


> Index: ./share/man/man8/daily.8
> ===
> RCS file: /cvs/src/share/man/man8/daily.8,v
> retrieving revision 1.28
> diff -u -p -r1.28 daily.8
> --- ./share/man/man8/daily.8  26 Jul 2020 13:27:24 -
> 1.28 +++ ./share/man/man8/daily.8 2 Oct 2020 18:12:39 -
> @@ -205,15 +205,6 @@ If set to 1, run
>  with the no-write flag.
>  .It Ev ROOTBACKUP
>  If set to 1, make a backup of the root file system.
> -.It Ev VERBOSESTATUS
> -If set to 0,
> -.Xr df 1 ,
> -.Xr dump 8 ,
> -and
> -.Xr netstat 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

The following would also have to go:

 * part of the list item "Checks disk status"
 * the list item "Reports networking statistics"
 * df(1) and netstat(1) in SEE ALSO

> Index: etc/daily
> ===
> RCS file: /cvs/src/etc/daily,v
> retrieving revision 1.93
> diff -u -p -r1.93 daily
> --- etc/daily 9 Sep 2019 20:02:26 -   1.93
> +++ etc/daily 2 Oct 2020 18:12:39 -
> @@ -137,20 +137,7 @@ next_part "Services that should be runni
>  rcctl ls failed
>  
>  next_part "Checking subsystem status:"

This output line should probably be updated, maybe something like:

   next_part "Backing up filesystems with dump:"

> -if [ "X$VERBOSESTATUS" != X0 ]; then
> - echo ""
> - echo "disks:"
> - df -ikl
> - echo ""
> - dump W
> -else
> - dump w | grep -vB1 ^Dump
> -fi
> -
> -next_part "network:"
> -if [ "X$VERBOSESTATUS" != X0 ]; then
> - netstat -ivn
> -fi
> +dump w | grep -vB1 ^Dump
>  
>  next_part "Running calendar in the background:"
>  if [ "X$CALENDAR" != X0 -a \



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Daniel Jakots
On Fri, 2 Oct 2020 19:55:53 +0200, Ingo Schwarze 
wrote:

> Hi,
> 
> Daniel Jakots wrote on Thu, Oct 01, 2020 at 10:32:31PM -0400:
> 
> > Currently daily(8) runs `df -ikl`.  
> 
> By default, it does not.  It only does that if you set VERBOSESTATUS.

Are you sure? It looks like it does not, *if* you set VERBOSESTATUS to
0. (And that's what daily(8) says as well).

> I would prefer deleting the VERBOSESTATUS parts completely,
> strictly enforcing the principle "daily(8) only produces output
> when something unexpected happens", and tell people to use
> daily.local(8) if they want to run df or netstat.  The code
> for those two parts is totally trivial and riddled with
> choices that look like personal preferences, like the one
> you suggest to change.

I agree, that would a better change indeed. I think I'll fix my
problem by setting VERBOSESTATUS to 0 and add what I want to my
daily.local.

> I dimly remember that some developers wanted to keep VERBOSESTATUS,
> though (i might misremember), so we'll probably keep it.  If we
> keep it, i absolutely don't care what it does.  So i'll neither OK
> this nor object to it.

Anyone cares about this one way or the other? Here's a diff for it. (If
we want to go this way, I'll craft a diff for current.html as well).


Index: ./share/man/man8/daily.8
===
RCS file: /cvs/src/share/man/man8/daily.8,v
retrieving revision 1.28
diff -u -p -r1.28 daily.8
--- ./share/man/man8/daily.826 Jul 2020 13:27:24 -
1.28 +++ ./share/man/man8/daily.8   2 Oct 2020 18:12:39 -
@@ -205,15 +205,6 @@ If set to 1, run
 with the no-write flag.
 .It Ev ROOTBACKUP
 If set to 1, make a backup of the root file system.
-.It Ev VERBOSESTATUS
-If set to 0,
-.Xr df 1 ,
-.Xr dump 8 ,
-and
-.Xr netstat 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
Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.93
diff -u -p -r1.93 daily
--- etc/daily   9 Sep 2019 20:02:26 -   1.93
+++ etc/daily   2 Oct 2020 18:12:39 -
@@ -137,20 +137,7 @@ next_part "Services that should be runni
 rcctl ls failed
 
 next_part "Checking subsystem status:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   echo ""
-   echo "disks:"
-   df -ikl
-   echo ""
-   dump W
-else
-   dump w | grep -vB1 ^Dump
-fi
-
-next_part "network:"
-if [ "X$VERBOSESTATUS" != X0 ]; then
-   netstat -ivn
-fi
+dump w | grep -vB1 ^Dump
 
 next_part "Running calendar in the background:"
 if [ "X$CALENDAR" != X0 -a \



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Kurt Mosiejczuk
On Fri, Oct 02, 2020 at 07:55:53PM +0200, Ingo Schwarze wrote:

> Daniel Jakots wrote on Thu, Oct 01, 2020 at 10:32:31PM -0400:

> > Currently daily(8) runs `df -ikl`.

> By default, it does not.  It only does that if you set VERBOSESTATUS.

Actually, it does do it by default. One needs to set VERBOSESTATUS=0
in order to stop it from doing so.

--Kurt



Re: Make df output more human friendly in daily(8)

2020-10-02 Thread Ingo Schwarze
Hi,

Daniel Jakots wrote on Thu, Oct 01, 2020 at 10:32:31PM -0400:

> Currently daily(8) runs `df -ikl`.

By default, it does not.  It only does that if you set VERBOSESTATUS.

I would prefer deleting the VERBOSESTATUS parts completely,
strictly enforcing the principle "daily(8) only produces output
when something unexpected happens", and tell people to use
daily.local(8) if they want to run df or netstat.  The code
for those two parts is totally trivial and riddled with
choices that look like personal preferences, like the one
you suggest to change.

I dimly remember that some developers wanted to keep VERBOSESTATUS,
though (i might misremember), so we'll probably keep it.  If we
keep it, i absolutely don't care what it does.  So i'll neither OK
this nor object to it.

Yours,
  Ingo



Make df output more human friendly in daily(8)

2020-10-01 Thread Daniel Jakots
Hi,

Currently daily(8) runs `df -ikl`. I find reading daily(8) emails hard
because in today's disk size, kilobyte counts are not sensible. I'd
like to replace -k by -h so the output is more human friendly. I doubt
anyone parses daily(8) so this shouldn't break anyone setup.

It seems that historically it was `df -k`, back when it was imported
from NetBSD in October 95. On the other hand, df's -h was added only in
April 97.


Comments? OK?

Cheers,
Daniel


Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.93
diff -u -p -r1.93 daily
--- etc/daily   9 Sep 2019 20:02:26 -   1.93
+++ etc/daily   2 Oct 2020 02:17:33 -
@@ -140,7 +140,7 @@ next_part "Checking subsystem status:"
 if [ "X$VERBOSESTATUS" != X0 ]; then
echo ""
echo "disks:"
-   df -ikl
+   df -hil
echo ""
dump W
 else