• Re: What's wrong with this entry in a cron job?

    From Leigh Brown@21:1/5 to Freek de Kruijf on Sat Mar 30 12:50:02 2024
    Hello,

    On 2024-03-30 10:52, Freek de Kruijf wrote:
    I have the following line in a cron job:

    1 1 * * * rm -v /srv/db/webhoneypot-$(date --date=yesterday
    +%Y-%m-%d).json

    I get in the journal:

    Mar 30 01:01:01 rpi4rasphon CRON[1254]: (root) CMD (rm -v /srv/db/webhoneypot-
    $(date --date=yesterday +)

    and in the e-mail

    /bin/sh: 1: Syntax error: end of file unexpected (expecting ")")

    man 5 crontab says:
    [..]
    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 cronfile. Percent-signs (%) in the
    command, un‐
    less 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.

    Regards,

    Leigh.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)