etckeeperを使用してsystemdで誤って設定されたネットワーク設定をロールバックしますか?

etckeeperを使用してsystemdで誤って設定されたネットワーク設定をロールバックしますか?

etckeeperとsystemdを使用してネットワーク構成エラーを自動的にロールバックする方法を考えています。

ワークフロー:

# etckeeper commit
# $EDITOR /etc/systemd/network/wired.network
# systemctl restart systemd-networkd
You broke the network! I'm calling your mom!
Here's your broken config:
$(cat broken_file)
$(etckeeper vcs reset -- old_config_file)

# $EDITOR /etc/systemd/network/wired.network
# systemctl restart systemd-networkd
# 

現在、再起動イベントに接続する方法が詰まっています。

gdbus monitor --system --dest org.freedesktop --object-path /org/freedesktop

実行時に何も出力しません

# systemctl restart systemd-networkd

スクリプト自体は次のとおりです。

  • systemdに接続するrestartか、可能であれば直接接続します。restart systemd-networkd
  • 再起動に失敗した場合はフック情報を読み、それ以外の場合はお読みください。systemctl is-active systemd-networkd
  • 破損したファイルの名前を$ file.brokenに変更します。
  • 再び覆う:etckeeper vcs reset -- $file
  • systemctl stop automatic-net-configuration-rollback.service(これを行うと無限ループは発生しません。)
  • systemctl restart systemd-networkd
    • 作品->systemctl start automatic-net-configuration-rollback.service
    • なし ->echo Rollbacked config file doesn't work either. Repair manually and start automatic rollback after it works.

これは可能ですか? systemdにはすでにそのようなサービスが組み込まれていますか?それとも誰かがすでにそのようなサービスを作成していますか?私のGoogle検索結果は空です。

ベストアンサー1

おすすめ記事