[linux] crontab eigenaardigheid

paai j.j.paijmans op gmail.com
Wo Jul 24 09:02:02 CEST 2019


On 24-07-19 08:50, Paul Slootman wrote:
> On Tue 23 Jul 2019, paai wrote:
>> $ /usr/bin/date "+const String versie=\"%m/%d/%y %H:%M\";" >
>> /home/paai/sketchbook/versie.inc
>>
>> en dat werkt vanaf de commandline: in de file versie.inc verschijnt
>>
>> const String versie="07/23/19 10:11";
>>
>>
>> Jammer genoeg werkt dit niet in crontab. Dan verschijnt alleen de date alsof
>> er geen format string is meegegeven.
> $ man 5 crontab
> ...
> The ``sixth'' field (the rest of the line) specifies the command to  be
> run.   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 crontab file.  Percent-signs (%) in the command,
> unless escaped with backslash (\), will be changed into newline characā€
> ters,  and  all  data  after the first % will be sent to the command as
> standard input.  There is no way to split a single  command  line  onto
> multiple lines, like the shell's trailing "\".
>
> Alles na een % wordt dus als input voor het commando gebruikt, waarbij
> verdere % tekens in newlines omgezet worden.
>
> Backslashes voor die % tekens zetten dus.
>
>
> Paul

Zoals ik al aangaf: dat hielp niet. Intussen heb ik er maar een scriptje van gemaakt dat door crontab wordt gerund, en dat werkt.

-- 
Dr J.J. Paijmans
paijmans.net v.a. Danzig



Meer informatie over de Linux maillijst