Hi Todd,

Todd C. Miller wrote on Wed, Oct 12, 2016 at 10:06:07AM -0600:

> Whitespace between the -q and the command is optional, not required.

No, according to my reading of the code and my testing, it is required.

The code say:

        case 'q':
                e->flags |= DONT_LOG;
                Skip_Nonblanks(ch, file)
                break;

So, if you don't put whitespace, the next word gets skipped,
and indeed:

  schwarze@isnote $ cat /etc/crontab      
  18 * * * * schwarze -qecho echo text > /tmp/cron_out_file
  21 * * * * schwarze echo echo text > /tmp/cron_out_file_noq

  schwarze@isnote $ ll /tmp/cron*
  -rw-r--r--  1 schwarze  wheel   5 Oct 12 18:18 /tmp/cron_out_file
  -rw-r--r--  1 schwarze  wheel  10 Oct 12 18:21 /tmp/cron_out_file_noq

  schwarze@isnote $ head /tmp/cron*
  ==> /tmp/cron_out_file <==
  text

  ==> /tmp/cron_out_file_noq <==
  echo text

So, OK to commit my version?

Yours,
  Ingo


Index: crontab.5
===================================================================
RCS file: /cvs/src/usr.sbin/cron/crontab.5,v
retrieving revision 1.33
diff -u -p -r1.33 crontab.5
--- crontab.5   30 Jan 2014 20:02:42 -0000      1.33
+++ crontab.5   12 Oct 2016 16:28:59 -0000
@@ -193,6 +193,14 @@ will be changed into newline characters,
 after the first
 .Ql %
 will be sent to the command as standard input.
+If the
+.Ar command
+field begins with
+.Ql -q ,
+execution will not be logged.
+Use whitespace to separate
+.Ql -q
+from the command.
 .Pp
 Commands are executed by
 .Xr cron 8
@@ -320,6 +328,9 @@ Ranges may include
 .Dq steps .
 .It
 Months or days of the week can be specified by name.
+.It
+Logging can be suppressed with
+.Ql -q .
 .It
 Environment variables can be set in a crontab.
 .It


> Index: crontab.5
> ===================================================================
> RCS file: /cvs/src/usr.sbin/cron/crontab.5,v
> retrieving revision 1.33
> diff -u -p -u -r1.33 crontab.5
> --- crontab.5 30 Jan 2014 20:02:42 -0000      1.33
> +++ crontab.5 12 Oct 2016 16:05:53 -0000
> @@ -193,6 +193,14 @@ will be changed into newline characters,
>  after the first
>  .Ql %
>  will be sent to the command as standard input.
> +If the
> +.Ar command
> +field begins with
> +.Ql -q ,
> +execution will not be logged.
> +Any whitespace between the
> +.Ql -q
> +and the command that follows it is ignored.
>  .Pp
>  Commands are executed by
>  .Xr cron 8

Reply via email to