Operating System - Linux
1829712 Members
2032 Online
109992 Solutions
New Discussion

Re: Compare script before and after a reboot

 
Ragni Singh
Super Advisor

Compare script before and after a reboot

I'm not sure if anyne have ever asked this but does anyone have a script and or a tool that comapres what was on a system beofre a reboot to whats on a system after a reboot. There are times when you do things to a system but then you forget all about it and after you reboot, you lose everything. I want to be able to have something that I can run before a reboot and compare that data to after a reboot to see if I have lost or missed anything. Something like a compare script of some sort. Thanks and points will definitely be assigned.
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: Compare script before and after a reboot

This is by no means complete, but should get you started. You need a decent amount of space on the /tmp directory to do this. You can do this whereever you want.


# run this code at boot time
cd /etc

cp -r * /tmp/etc

# you can tar it for space.



#
# run this part at shutdown

cd /etc
ls -r > /tmp/filelist

read -r filename
do
diff $filename /tmp/etc/$filename
done < /tmp/filelist


This will give you a listing of every change to every configuration file since reboot.

Direct the output to a file and you'll have a log of everything that was done since boot.

I didn't try this and it may need work, this is merely a brainstorm effort.

Because I don't trust myself or totally trust technology, I keep a paper notebook with a written record of what I did when. Thats useful too.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ragni Singh
Super Advisor

Re: Compare script before and after a reboot

I'll try this but I was hoping for more.
Helen French
Honored Contributor

Re: Compare script before and after a reboot

You may want to consider putting a startup/shutdown script. You can include comments and commands to compare the results you want in it and output to a log file. Tools you want to include in this script depend on your specific need. You may include disk utilization checks, kernel change checks, network checks, configuration check, application check etc. Is this what you looking for?
Life is a promise, fulfill it!
Ragni Singh
Super Advisor

Re: Compare script before and after a reboot

Yes, thats exactly what I'm looking for. Does someone already have a script that does that? If not, then I will start working on one.
Huc_1
Honored Contributor

Re: Compare script before and after a reboot

Sanjit, I do not know what version/distribution of linux you are running, but if it is a "Redhat" then what i use is sysreport ... to invoke just type

#sysreport

This is a bite of an overkill but what it does is prepare a diagnostic report for to mail to redhat in case you need help ! "But this mail is generated but not send ,you have to manualy send this"

sysreport will log all hardware and software environment (rpm,disk,tape,ps -ef,network setup and much more)

If you run prio/after change and the make a diff on the two mails you get a very exhaustive picture of what is different.

I also like to save a copy of this to a read only media support for contigency.

It may but more then what you ask for but hope it helps .

J-P
Smile I will feel the difference
Steven E. Protter
Exalted Contributor

Re: Compare script before and after a reboot

Usually to start a start/shut script i copy one i like from /etc/init.d

Some distributions have one called /etc/init.d/template which is generic and is used for creating new scripts from scratch. my original code might work if called from such a script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com