#!/bin/bash
# a2system Backs up or recover all files in / directory
# update: 06/08/2005
if [ "$#" = 0 ]; then
echo "使用方法:"
echo " 1)sudo ./$(basename "$0") filename backup 用于备份系统"
echo " 2)sudo ./$(basename "$0") filename recover 用于恢复系统"
exit 1
fi
if [ "$2" = "backup" ];
then
aptitude clean
tar jcvfp /"$1".tar.bz2 / --exclude=/proc --exclude=/lost+found
--exclude=/mnt --exclude=/sys --exclude=/"$1".tar.bz2
--exclude=/windows --exclude=/media --exclude=/tmp
elif [ "$2" = "recover" ];
then
tar jxvfp /"$1".tar.bz2 -C /
mkdir /proc /lost+found /mnt /sys /media /windows /tmp
else
echo "请确认你输入的第二个命令行参数是否正确!"
fi
阅读(1085) | 评论(0) | 转发(0) |