Is /etc/rc.local called twice on boot?

Chris Green cl at isbd.net
Tue Oct 26 13:05:31 UTC 2021


On Tue, Oct 26, 2021 at 02:38:27PM +0200, Oliver Grawert wrote:
> hi,
> Am Dienstag, dem 26.10.2021 um 13:29 +0100 schrieb Chris Green:
> > On Tue, Oct 26, 2021 at 12:50:25PM +0200, Oliver Grawert wrote:
> > > hi,
> > > Am Dienstag, dem 26.10.2021 um 11:42 +0200 schrieb Bo Berglund:
> > > > IPAddr=$(ifconfig eth0|grep "inet "|sed 's/ *inet //;s/ .*//')
> > > > IPMac=$(ifconfig eth0 | grep -Eo ..\(\:..\){5})
> > > > 
> > > independent from your particular double execution issue, you should
> > > note that ifconfig (and ifupdown alongside) have long been
> > > abandoned in
> > > debian and ubuntu ...
> > > 
> > > you should use "ip addr show dev eth0" on modern distros 
> > > 
> > Which is a pretty poor 'improvement' on ifconfig as you have to know
> > the device name and it almost certainly *isn't* 'eth0' nowadays.
> > 
> > It's much easier to remember just 'ifconfig' and it tells you what
> > you
> > want to know! :-)
> 
> i was only referrring to the code that bo posted where "ifconfig eth0"
> is called ... 
> 
> "ip addr" does indeed behave similar to ifconfig and lists all devices
> by default without having to use a name ...
> 
It's still not as user friendly though:-

    chris$ ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 90:1b:0e:06:bc:91 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.3/24 brd 192.168.1.255 scope global noprefixroute enp0s25
           valid_lft forever preferred_lft forever
        inet6 fe80::bf69:378e:5ca7:2b2a/64 scope link noprefixroute 
           valid_lft forever preferred_lft forever
    chris$ ifconfig
    enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.1.3  netmask 255.255.255.0  broadcast 192.168.1.255
            inet6 fe80::bf69:378e:5ca7:2b2a  prefixlen 64  scopeid 0x20<link>
            ether 90:1b:0e:06:bc:91  txqueuelen 1000  (Ethernet)
            RX packets 4125  bytes 992965 (992.9 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 4400  bytes 515629 (515.6 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 20  memory 0xf7d00000-f7d20000  

    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 581  bytes 46916 (46.9 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 581  bytes 46916 (46.9 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    chris$ 

I'm not really *that* worried by the changes but it does seem a pity that the deprecated 
command actually provides what one most often wants to know in a rather neater form than
the new replacement.


-- 
Chris Green




More information about the ubuntu-users mailing list