On 2016-03-31 02:53, Tom H wrote:
On Thu, Mar 31, 2016 at 12:10 AM, Benjamin Lefoul
<[email protected]> wrote:

But sed -i ALSO changes the inode, and as I said it doesn't work:

root@hoptop:~# touch a
root@hoptop:~# ls -i a
9700011 a
root@hoptop:~# sed -i 's/q/a/g' a
root@hoptop:~# ls -i a
9700013 a

Benjamin Lefoul


________________________________________
From: [email protected] 
<[email protected]> on behalf of Tom H 
<[email protected]>
Sent: 30 March 2016 23:00
To: SL Users
Subject: Re: How does NetworkManager monitor the connection files?

On Wed, Mar 30, 2016 at 3:49 PM, Benjamin Lefoul
<[email protected]> wrote:

I have set monitor-connection-files=true in my
/etc/NetworkManager/NetworkManager.conf

It works fine (in fact, instantly) if I edit
/etc/sysconfig/network-scripts/ifcfg-eth0 with emacs or vi (for instance,
changing the IP).

It fails miserably if I use sudoedit, or sed:

# grep 100 /etc/sysconfig/network-scripts/ifcfg-eth0
IPADDR=192.168.4.100

# sed -i 's/100/155/g' /etc/sysconfig/network-scripts/ifcfg-eth0

Even though all stats (access modify and change) are renewed.

It's worse than that: even nmcli con reload afterwards fails.

In fact, the only way to get the ip to change is by entering the file with
vi, not touching it, and leave with ":wq" (not just ":q").

Why is that? What is going on here?

I know, I know, I can use nmcli in scripts, and not string-manipulation
tools, but say I don't want to... :)

And still, during operations, I'd rather edit the files with sudoedit...

"sudo -e ifcfg-file" doesn't change the inode. Can you use "sudo vi
ifcfg-file"? (Or whichever editor you prefer.)

Please bottom-post.

Sorry, my mind somehow discarded the sed case.

So the inode's not being monitored...


Careful, Tom. Too much of that whining about top/bottom post may prod me to side post and annoy everybody. It's done it in the past.

{^_-}

Reply via email to