I am relatively new to systemd and am learning its architecture.
Right now, I'm trying to figure out how to cause a custom shell script to run. This script needs to run after the networking layer has started up.
I'm running Arch, using systemd as well as netctl.
To test, I wrote a simple script that simply executes
ip addr list > /tmp/ip.txt. I created the following service file for this script.
(/etc/systemd/system/test.service) [Unit] Description=test service [Service] ExecStart=/root/test.script [Install] WantedBy=multi-user.target
I then enabled the script with,
systemctl enable test
Upon restarting, the script does indeed run, but it runs prior to the network being started. In other words, the output in
ip.txt displays no IPv4 address assigned to the primary interface. By the time I login, the IPv4 address has indeed been assigned and networking is up.
I'm guessing I could alter the point at which the script runs by messing with the
WantedBy parameter, but I'm not sure how to do that.
Could someone point me in the right direction?