Linux system configuration from a text file at boot

I have a VF50 running Linux 2.5. On the device, I have a single text file which contains system configuration information, such as ip address, network information and services that need to be enabled or disabled at boot up (such as ntp, ssh, ftp). I need to configure the system from this text file at boot.

I have written a C program that reads this text configuration file and creates the required system configuration files for networking and also calls systemctl to enable or disable the required services.

However, as a bit of a newby to Linux, I’m not exactly sure what my service file should look like in order to run this program after the file system is up, but before networking and any of the optional services have started.

I currently have the following service file, but it does not seem to work correctly:

[Unit]
Description=Load configuration files
After=local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/configure
 
[Install]
WantedBy=multi-user.target

Any help on this would be most appreciated.

Systemd starts things in parallel, hence it is not guaranteed that your service is executed before other services start. Since you alter network configuration, you probably might want to add Before directives, e.g. to make sure your service is run before network:

Before=network-pre.target

You probably need to specify other targets/units too to ensure they won’t get started before your service (Before takes a space seperated list, see also this page).