On Mon, 2019-01-14 at 00:59 +0530, Danishka Navin wrote:
Hi,
I have written a script which suppose to run at start-up and set a
given IP.
I can see systemd service is running when I check the status but I
can find the expected result (new IP).
Is there anything wrong with the following format of the service
file?
[Unit]
Description=Config IP
ConditionFileIsExecutable=<path_to_script>/script
After=network.target
StartLimitIntervalSec=0
[Service]
ExecStart=<path_to_script>/script
[Install]
WantedBy=multi-user.target
Is it ok to restart network service with the script I use?
Systemd won't let you run 'systemctl restart ...' inside of a service
script. It's an attempt to avoid infinite loops, I think.
The last time I tried that I had to modify my script to nohup, sleep,
and then call systemctl.