back to the upper level
On-the-fly /etc/sysconfig/ethercat
I have several diskless computers which share the same NFS root filesystem in read-only. But each computer needs its own /etc/sysconfig/ethercat
file because the MAC addresses are different.
The solution is to generate a custom /etc/sysconfig/ethercat
during the boot process, just before starting the ethercat service.
Scripts
How to use it?
- On the NFS root filesystem:
- Create a symbolic link
/etc/sysconfig/ethercat -> /dev/shm/ethercat_sysconfig
.
So the ethercat service script will use a configuration file in the /dev/shm
ramdisk.
- Create the configuration file
/etc/sysconfig/ethercat.conf.py
- Modify the booting sequence to call gen_ethercat_config.py before starting the ethercat service.
- the script will create the file
/dev/shm/ethercat_sysconfig
- Call
/etc/init.d/ethercat
to start the ethercat service
- Because of the symbolic link, each computer will use its own ethercat configuration file, in the ramdisk.
How does it works?
- The script parses
/proc/net/dev
to get the Ethernet interfaces names.
- For each Ethernet interface, it get the MAC address and search for a corresponding entry into ethercat.conf.py
- If it matches, it adds an entry into
/dev/shm/ethercat_sysconfig
.
Updated on January 17th, 2014 by Sebastien BLANCHET