Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #227292

Re: notify via virtual terminal available packages

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups linux.debian.user
Subject Re: notify via virtual terminal available packages
Date 2020-09-24 16:00 +0200
Message-ID <ASzWW-3NY-3@gated-at.bofh.it> (permalink)
References <ASjS9-2t3-9@gated-at.bofh.it> <ASzNf-3Kv-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

notify via virtual terminal available packages Pòl Hallen <deben@fuckaround.org> - 2020-09-23 22:50 +0200
  Re: notify via virtual terminal available packages john doe <johndoe65534@mail.com> - 2020-09-24 10:40 +0200
  Re: notify via virtual terminal available packages Charles Curley <charlescurley@charlescurley.com> - 2020-09-24 15:50 +0200
    Re: notify via virtual terminal available packages Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-24 16:00 +0200
      Re: notify via virtual terminal available packages Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-24 16:40 +0200
        Re: notify via virtual terminal available packages Charles Curley <charlescurley@charlescurley.com> - 2020-09-24 16:50 +0200
          Re: notify via virtual terminal available packages Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-24 17:00 +0200
          Deterministic delays in POSIX shell scripts (Was: Re: notify via  virtual terminal available packages) Andy Smith <andy@strugglers.net> - 2020-09-25 09:50 +0200
            Re: Deterministic delays in POSIX shell scripts (Was: Re: notify via  virtual terminal available packages) Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-25 13:50 +0200
              Re: Deterministic delays in POSIX shell scripts (Was: Re: notify via  virtual terminal available packages) Andy Smith <andy@strugglers.net> - 2020-09-25 14:30 +0200
                Re: Deterministic delays in POSIX shell scripts (Was: Re: notify via  virtual terminal available packages) David Wright <deblis@lionunicorn.co.uk> - 2020-09-26 04:50 +0200
      Re: notify via virtual terminal available packages Charles Curley <charlescurley@charlescurley.com> - 2020-09-24 16:40 +0200

csiph-web