:: Re: [DNG] new freedesktop "standard…
Góra strony
Delete this message
Reply to this message
Autor: Arnt Karlsen
Data:  
Dla: dng
Temat: Re: [DNG] new freedesktop "standard": /etc/machine-id
On Fri, 8 Mar 2019 22:56:36 +0100, Alessandro wrote in message
<93850f1a-3feb-adc9-1cd0-8ca8736fc970@???>:

> On 08/03/19 at 18:38, Arnt Karlsen wrote:
> >
> > ..my /etc/cron.d/machine-id:
> > PATH=/bin:/usr/bin:/sbin:/usr/sbin
> >
> > # ..a new /etc/machine-id every minute... ;o)
> > * * * * * root date |md5sum |cut -d" " -f-1 >/etc/machine-id |tee
> > >/dev/null 2>&1
>
>
>   What is tee doing there?


..allows logging the generated IDs with e.g.
" |tee >>/var/log/machine-IDs ", some people
might need to do that.

>   It duplicates it's standard input to each of the files it sees as
> parameters, and it has none.
>
>   Plus, it emits it's standard input to it's standard output, which
> gets discarded.
>
>   What is the purpose of doing this?
>
>
>   I'd just do this instead:
>
> echo $RANDOM | md5sum | cut -c 1-32 > /etc/machine-id
>
>
> or maybe:
>
>
> dd count=1 if=/dev/urandom 2> /dev/null | md5sum | cut -c 1-32 >
> /etc/machine-id


..both valid improvements, me, I might go: " * * * * * root \
fortune &&date |md5sum |cut -d" " -f-1 >/etc/machine-id |tee \
>/dev/null 2>&1 " to keep this lightweight in my end and not

in the other end. :o)


--
..med vennlig hilsen = with Kind Regards from Arnt Karlsen
...with a number of polar bear hunters in his ancestry...
Scenarios always come in sets of three:
best case, worst case, and just in case.