Install changetrack
Summary :
In order to track configuration files , and when we found something wrong with configuration file , we can rollback to a history version . we use changetrack to help us.
Install changetrack :
1) install changetrack :
yum --enablerepo=cnc install changetrack
Configure changetrack :
1) add the configure files you want to monitor:
vi /etc/changetrack.conf , for example :
Uncomment this line : #@ /etc -name "*.conf"
Add this line : /etc/test.cnf
How to run Changetrack :
1)schedule a cronjob like :
0 12 * * * /usr/bin/changetrack -q
This will run every day at noon , and you can just run command “changetrack” after you modified the configuration file , so that the prevision version can be restored.
How to rollback :
1)Check the history information of a configuration file , for example /etc/test.cnf :
rlog /var/db/changetrack/RCS/etc:test.cnf,v
Every time someone changed monitored configuration file , the new version is restored in change tracking system.
2)Rollback to version 1.2 :
co -r1.2 /var/db/changetrack/RCS/etc:test.cnf,v
This will generate a file ”etc:test.cnf” in current directory , you can replace /etc/test.cnf with this new file.
本文出自 “Linux运维” 博客,转载请与作者联系!