37
44

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

/etc をバージョン管理する etckeeper

Last updated at Posted at 2017-04-27

etckeeper

http://etckeeper.branchable.com/
/etc 配下のファイルのバージョン管理を簡易、自動化する。

http://source.etckeeper.branchable.com/?p=source.git;a=summary
意外に継続的に開発が行われている模様。

インストール

yum -y install epel-release git && yum -y install etckeeper

初期化

etckeeper init

Initialized empty Git repository in /etc/.git/ と返ってきて空のリポジトリが作成される。

設定

sed -i -e '/PUSH_REMOTE/ s/""/"origin"/' /etc/etckeeper/etckeeper.conf
cd /etc && git remote add origin gitのURL

コミット

etckeeper commit ":tada: Initail commit"

Cron

etckeeper commit "daily autocommit" >/dev/null

/etc/cron.daily/etckeeper から /etc/etckeeper/daily が呼び出され、上記コマンドが実行される。

systemd timer

sed -i '/AVOID_DAILY_AUTOCOMMITS/ s/^#//' /etc/etckeeper/etckeeper.conf
systemctl enable etckeeper.timer && \
systemctl start etckeeper.timer && \
systemctl list-timers

ログ

etckeeper vcs log
etckeeper vcs reflog

差分

etckeeper vcs diff HEAD

リストア

etckeeper vcs checkout コミット名 リストアするファイル

専用コマンドがないと方々で大不評。

37
44
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
37
44

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?