Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jun 2021 09:42:22 +0200 (CEST)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        freebsd-stable@freebsd.org
Subject:   Re: cron line continuation?
Message-ID:  <50183224.330.1623051742099@localhost>
In-Reply-To: <20210606165738.f944a3649687a4ae09bb3cf6@getmail.no>
References:  <0d9ed5fb-7b98-8fa5-2429-a00c615afc69@klop.ws> <20210606165738.f944a3649687a4ae09bb3cf6@getmail.no>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_329_1222429098.1623051742094
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

 
Van: Torfinn Ingolfsen <torfinn.ingolfsen@getmail.no>
Datum: zondag, 6 juni 2021 16:57
Aan: freebsd-stable@freebsd.org
Onderwerp: Re: cron line continuation?
> 
> On Sun, 6 Jun 2021 13:56:18 +0200
> Ronald Klop <ronald-lists@klop.ws> wrote:
> 
> > Hi,
> >
> > I'm trying to create a cron entry with line continuation. This document mentions the \ character:
> > https://docs.freebsd.org/doc/13.0-RELEASE/usr/local/share/doc/freebsd/en_US.ISO8859-1/books/handbook/configtuning-cron.html
> >
> > The manual pages do not mention this and I can't get it to work.
> >
> > Is this possible?
> 
> 'man 5 crontab' has this section
>      The ``sixth'' field (the rest of the line) specifies the command to be
>      run.  One or more command options may precede the command to modify
>      processing behavior.  The entire command portion of the line, up to a
>      newline or % character, will be executed by /bin/sh or by the shell
>      specified in the SHELL variable of the cronfile.  Percent-signs (%) in
>      the command, unless escaped with backslash (\), will be changed into
>      newline characters, and all data after the first % will be sent to the
>      command as standard input.
> 
> HTH
> -- 
> Torfinn Ingolfsen <torfinn.ingolfsen@getmail.no>
>  
> 
> 
> 


Thank you for your answer. I read that part of the manual page. It says that everything after % is used as standard input. That is not what I'm looking for.

I would like to rewrite this:
@daily freebsd-update -b /data/jails/freebsd13 -d /data/jails/freebsd13/var/db/freebsd-update/ -f /data/jails/freebsd13/etc/freebsd-update.conf --currently-running $( /data/jails/freebsd13/bin/freebsd-version -u) cron && freebsd-update -b /data/jails/freebsd13 -d /data/jails/freebsd13/var/db/freebsd-update/ -f /data/jails/freebsd13/etc/freebsd-update.conf --currently-running $( /data/jails/freebsd13/bin/freebsd-version -u) updatesready > /dev/null && freebsd-update -b /data/jails/freebsd13 -d /data/jails/freebsd13/var/db/freebsd-update/ -f /data/jails/freebsd13/etc/freebsd-update.conf --currently-running $( /data/jails/freebsd13/bin/freebsd-version -u) install

to this:
@daily freebsd-update -b /data/jails/freebsd13 -d /data/jails/freebsd13/var/db/freebsd-update/ -f /data/jails/freebsd13/etc/freebsd-update.conf --currently-running $( /data/jails/freebsd13/bin/freebsd-version -u) cron \
            && freebsd-update -b /data/jails/freebsd13 -d /data/jails/freebsd13/var/db/freebsd-update/ -f /data/jails/freebsd13/etc/freebsd-update.conf --currently-running $( /data/jails/freebsd13/bin/freebsd-version -u) updatesready > /dev/null \
            && freebsd-update -b /data/jails/freebsd13 -d /data/jails/freebsd13/var/db/freebsd-update/ -f /data/jails/freebsd13/etc/freebsd-update.conf --currently-running $( /data/jails/freebsd13/bin/freebsd-version -u) install

which is much better readable. I can't get this to work so the documentation might be inconsistent.

Regards,
Ronald.
 
------=_Part_329_1222429098.1623051742094--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50183224.330.1623051742099>