Conf File Backup Idea

Terry Barnaby terry1 at beam.ltd.uk
Sat Aug 1 07:41:12 UTC 2009


On 08/01/2009 04:58 AM, Tony Nelson wrote:
> On 09-07-31 19:17:46, Thom Paine wrote:
>> Thanks for the suggestions. I'll have a look at some of them and see
>> if I can figure something out.
>>
>> I don't mind manually making lists of files as I start working with
>> them. What really prompted this was that I have some home automation
>> working really well on an old server I had. One power outtage that
>> lasted longer than 30 minutes while I was away from home, two hard
>> drives in the array went offline. I thought the whole server was lost
>> and last night I dusted it off and rooted around in the adaptec
>> interface and was able to force them both back online and bring the
>> array back up. I quickly copied off my heyu files but I got to
>> thinking if there was a way to automatically rsync files somewhere
>> when I edit them, it would make things simpler on a server I have no
>> need to completely back up, yet have some good info on it.
>
> I'm a sloppy person, so I set up an rsync-based solution derived from a
> script I snagged through googling.  It keeps 4-hourly, daily, 4 weekly,
> and several monthly rotating backups of the directories I list.  Let me
> know if you want it.  Sometime I'll clean it up some more and put it on
> my web site.
>

Something that we do to get most of the configuration files backed up is:

# Create list of RPM config files that have changed
 > files_rpmconfig
rpm -qac --dump  | sed -e "/^(/d" | while read -a line
do
#	echo "Line: ${line[0]} ${line[3]}"
	if false
	then
		if [ ! -r ${line[0]} ]
		then
			echo "Unable to access file: ${line[0]}"
		fi
	fi
	if [ -f ${line[0]} ]
	then
		fi=(`md5sum ${line[0]}`)
#		echo "Sum: ${fi[0]}"
		if [ ${fi[0]} != ${line[3]} ]
		then
			echo "${line[0]}" >> files_rpmconfig
		fi
	fi
done

This should backup any files that are marked as configuration files in the RPM 
packages and have changed. If you has installed tarballs etc, you will obviously
have to add any configuration files for those manually. We normally do this
during OS updates so we can quickly look back at configuration changes without
having to go and get the full backup disk.

Cheers


Terry




More information about the users mailing list