Re: Deterministic delays in POSIX shell scripts (Was: Re: notify via virtual terminal available packages)

2020-09-25 Thread David Wright
On Fri 25 Sep 2020 at 12:28:31 (+), Andy Smith wrote: > On Fri, Sep 25, 2020 at 07:49:19AM -0400, Greg Wooledge wrote: > > On Fri, Sep 25, 2020 at 07:44:25AM +, Andy Smith wrote: > > > "hostid" tends to return a hexadecimal representation of the first > > > IPv4 address (but isn't guarantee

Re: Deterministic delays in POSIX shell scripts (Was: Re: notify via virtual terminal available packages)

2020-09-25 Thread Andy Smith
Hello, On Fri, Sep 25, 2020 at 07:49:19AM -0400, Greg Wooledge wrote: > On Fri, Sep 25, 2020 at 07:44:25AM +, Andy Smith wrote: > > "hostid" tends to return a hexadecimal representation of the first > > IPv4 address (but isn't guaranteed to). > > unicorn:~$ hostid > 007f0101 > > Doesn't look

Re: Deterministic delays in POSIX shell scripts (Was: Re: notify via virtual terminal available packages)

2020-09-25 Thread Greg Wooledge
On Fri, Sep 25, 2020 at 07:44:25AM +, Andy Smith wrote: > "hostid" tends to return a hexadecimal representation of the first > IPv4 address (but isn't guaranteed to). unicorn:~$ hostid 007f0101 Doesn't look very useful. That's just 127.0.1.1 in a 16-bit little endian format. > On a systemd

Deterministic delays in POSIX shell scripts (Was: Re: notify via virtual terminal available packages)

2020-09-25 Thread Andy Smith
Hello, On Thu, Sep 24, 2020 at 08:49:07AM -0600, Charles Curley wrote: > On Thu, 24 Sep 2020 10:38:55 -0400 > Greg Wooledge wrote: > > So you're just doing "sleep 1" every time. > > Ah, thank you. Yup. Which is weird, because it worked when I first > wrote that many years ago. In cron scripts w

Re: notify via virtual terminal available packages

2020-09-24 Thread Greg Wooledge
On Thu, Sep 24, 2020 at 08:49:07AM -0600, Charles Curley wrote: > Ah, thank you. Yup. Which is weird, because it worked when I first > wrote that many years ago. "Many years ago", sh was probably a link to bash, rather than dash.

Re: notify via virtual terminal available packages

2020-09-24 Thread Charles Curley
On Thu, 24 Sep 2020 10:38:55 -0400 Greg Wooledge wrote: > In dash, RANDOM does nothing; it's just an empty variable. And as it > turns out, dash treats that as a zero. > > unicorn:~$ dash > $ echo $((1 + RANDOM % 1200)) > 1 > $ echo $((1 + % 1200)) > dash: 2: arithmetic expression: expecting pr

Re: notify via virtual terminal available packages

2020-09-24 Thread Greg Wooledge
On Thu, Sep 24, 2020 at 08:10:04AM -0600, Charles Curley wrote: > On Thu, 24 Sep 2020 09:53:59 -0400 > Greg Wooledge wrote: > > > 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. > > Well, that

Re: notify via virtual terminal available packages

2020-09-24 Thread Charles Curley
On Thu, 24 Sep 2020 09:53:59 -0400 Greg Wooledge wrote: > 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. Well, that's interesting. The file I pulled that from (in /etc/cron.d) sets two variables

Re: notify via virtual terminal available packages

2020-09-24 Thread Greg Wooledge
On Thu, Sep 24, 2020 at 07:23:28AM -0600, Charles Curley wrote: >5 3 ** * rootsleep $( 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

Re: notify via virtual terminal available packages

2020-09-24 Thread Charles Curley
On Wed, 23 Sep 2020 22:36:36 +0200 Pòl Hallen wrote: > like ubuntu, what's the best way to show a notify alert (via > terminal) about available packages? I take it you mean, *new* available packages. I don't know how Ubuntu does it, so I'll tell you what I do. And the answer depends on what you

Re: notify via virtual terminal available packages

2020-09-24 Thread john doe
On 9/23/2020 10:36 PM, Pòl Hallen wrote: Hi :-) like ubuntu, what's the best way to show a notify alert (via terminal) about available packages? I can't talk about Ubuntu but you could use a cronjob that checks periodicly for new updates and use 'wall' to notify the users. -- John Doe