Re: notify via virtual terminal available packages
On Thu, Sep 24, 2020 at 07:23:28AM -0600, Charles Curley wrote:
> 5 3 * * * root sleep $( echo $((1 + RANDOM \% 1200)) ) ; /usr/bin/apt-get update > /dev/null && /usr/bin/apt-get -dy dist-upgrade > /dev/null
RANDOM is a bashism, not available in sh, so that won't work in a
crontab unless you've altered which shell cron is using to parse the
crontab.
If you *do* use bash to parse the line, then the $( echo ... ) bit is
unnecessary.
sleep $((1 + RANDOM \% 1200))
But the safer way is simply to assume that the crontab is being parsed by
sh (because that's what is actually used by default), and move your
bash-specific code to a script. Then call the script from the crontab.
Reply to: