Initial check in.

This commit is contained in:
ccurley 2007-07-08 17:07:31 +00:00
parent 31ce94cc14
commit 6fbc1a7a02
3 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# partition table of /dev/hda
unit: sectors
/dev/hda1 : start= 63, size= 116865, Id= 6, bootable
/dev/hda2 : start= 116928, size= 153216, Id=83
/dev/hda3 : start= 270144, size= 286272, Id=82
/dev/hda4 : start= 556416, size= 3568320, Id= 5
/dev/hda5 : start= 556479, size= 3568257, Id=83

View File

@ -0,0 +1,103 @@
# -*- shell-script -*-
# Time-stamp: <2007-07-06 13:31:22 ccurley get.target>
# Copyright 2000 through the last date of modification, Charles Curley.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA
# You can also contact the Free Software Foundation at
# http://www.fsf.org/
# How to determine the target: the directory structure is
# /..../back/hostname.OS.etc So we have to get the name of the
# directory. That gives us host name and OS.etc. From that we extract
# the host name.
path=`pwd`
target=${path##/*/}
host=${target%%.*}
# Run "info date" for more information.
DATE=`date +%Y%m%d`
# echo "Today's date is $DATE."
echo "\$target is $target. \$host is $host. Today's date is $DATE."
name=$0
echo "This is script $name"
if [ $(echo $name | grep -i get > /dev/null) ] ; then
# Do functions common to all restores.
# Which archive do we restore and is this a valid target name?
TARGET=$1
if [ -z $TARGET ] ; then
echo Please specify a target from one of:
for dir in $(ls -d $host.*) ; do
if [ -d $dir ] ; then
echo -n "$dir "
fi
done
exit 2;
fi
if [ -z $TARGET ] || [ ! -d $TARGET ] ; then
echo $TARGET does not exist!
exit 2;
fi
ssh $host rm -r /var/lib/rpm
else
# Do functions common to all gets.
# Where we will get the archives on the target.
#zip=/mnt/zip
export zip="/var/lib/bare.metal.recovery";
# If it does not already exist, build the archive.
ssh $host "if [ ! -d ${zip}/$DATE ] ; then echo Saving metadata... ; save.metadata ; fi"
echo Backing up $host
if [ -e $host.$DATE ] ; then
rm -r $host.$DATE
fi
echo Copying the bare metal recovery archive.
# -r for recursive copy, -p to preserve times and permissions, -q
# for quiet: no progress meter.
scp -qpr $host:$zip/$DATE $host.$DATE
du -hs $host.*
echo Cleaning out old yum packages
ssh $host "yum clean packages"
echo Backing up $host to the backup server.
if [ -e $host.$DATE.tar.bz2 ] ; then
rm $host.$DATE.tar.bz2
fi
fi

View File

@ -0,0 +1,43 @@
#! /bin/sh
# A script to install the bare metal recovery scripts. With any luck,
# this will comply with the "Filesystem Hierarchy Standard",
# http://www.pathname.com/fhs/, version 2.3, announced on January 29,
# 2004.
# Time-stamp: <2007-07-06 13:33:29 ccurley install>
# Copyright 2007 through the last date of modification, Charles Curley.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA
# You can also contact the Free Software Foundation at
# http://www.fsf.org/
# Where we put the archives ready for making CDs, etc.
mkdir -p /var/lib/bare.metal.recovery
# Keep them secure from pesky snooping users who don't need to be able
# to hack a copy of, say, /etc/shadow.
chmod 700 /var/lib/bare.metal.recovery
# Backup time executables.
cp -rp save.metadata make.fdisk /usr/sbin
# Save the recovery time executables we provide. The archiving
# programs look for them here and save them into the archives.
mkdir -p /etc/bare.metal.recovery
cp -rp first.stage restore.metadata /etc/bare.metal.recovery