脚本欣赏----shell script to clone linux system - 20041201
from: http://www.yick.org/website/index.php?module=documents&jas_documentmanager_op=viewdocument&jas_document_id=12 代码: #!/bin/sh # desc: dump and restore disk using dump and restore commands # author: swergar # # *** please read the bottom of this script for help *** # ## configurations # which dir to store backup files? #backdir="/mnt/ghost/`hostname -s`" backdir="/opt/backup" # which dir to store backup files? #backdir="/mnt/ghost/test" # which dir/files want to exclude? exclude="/var/log /var/spool/mail /opt/config_backup $backdir" # define these values for raid system phydisk=hda mirrordisk=hdb ################################################################################ # detect raid israid=`grep `df / | grep ^/dev| cut -d " " -f 1 | sed s//dev///g` /proc/mdstat | grep -c md` if [ "$israid" -gt "0" ] ; then raiddevice="yes" ; md=`df / | grep ^/dev| cut -d " " -f 1 | sed s//dev///g| sed s/[0-9]//g` dumpprts=`df | grep ^/dev/$md | sed s/ */ /g| cut -d " " -f 6| grep -v "^/$" ` rm -f /tmp/fstab.raid /tmp/df.txt raid=`cat /proc/mdstat | grep ^md| cut -d " " -f 1,5| tr " " ":" | sed s/[[0-9]]//g` for i in $raid ; do hrd=`echo $i | cut -d ":" -f 1` hdev=`echo $i | cut -d ":" -f 2| sed s/[a-z]//g` ... 下一页