<div dir="ltr">Hi,<div><br></div><div>I'm interested in rollbacking misconfigured network configs back to last working state. Old config is stored by etckeeper which uses git.</div><div><br></div><div>Can this be achieved with systemd itself or do I have to write whole script/program that listens to systemd dbus?</div><div><br></div><div><br></div><div><div>If it's script/program it will be something like:</div><div><br></div><div>-Hook into "systemd restart" in dbus and if possible, directly into "restart systemd-networkd"</div><div>-If event contains that restart failed, use that; otherwise read "systemctl is-active systemd-networkd"</div><div>-Rename broken file to $file.broken</div><div>-Restore: etckeeper vcs reset -- $file</div><div>-"systemctl stop that-network-restart-hook-script.service" (so that there's no infinite loop)</div><div>-"systemctl restart systemd-networkd"</div><div>-Works -> "systemctl start automatic-net-configuration-rollback.service"</div><div>-Doesn't -> echo "Rollbacked config file doesn't work either. Repair your network config file manually and start automatic rollback script service after it works."</div></div><div><br></div><div>Also is there any kind of config file tester so it could be also run before. Something like:</div><div># systemd-config --test my-config.network</div><div>File is broken!</div><div># echo $?</div><div># 1</div><div><br></div><div><br></div><div><div><br></div>-- <br><div class="gmail_signature">Pekka Järvinen</div>
</div></div>