diff --git a/backup-daemon/data/backup-auto b/backup-daemon/data/backup-auto index 9cd8720..07cde1f 100755 --- a/backup-daemon/data/backup-auto +++ b/backup-daemon/data/backup-auto @@ -343,7 +343,7 @@ caculateSystemSize(){ disk_freeDisk=${result[1]} disk_usedDisk=${result[2]} - if [ $disk_totalSize = $root_totalSize -a $disk_freeDisk = $root_freeDisk -a $disk_usedDisk = $root_usedDisk ]; then + if [[ $disk_totalSize = $root_totalSize && $disk_freeDisk = $root_freeDisk && $disk_usedDisk = $root_usedDisk ]]; then continue fi @@ -423,7 +423,7 @@ checkBackupCapacity() { #(m_rootPath.toStdString().c_str(), retstatus)) #echo "--backup_freeDisk="$backup_freeDisk #echo "--backup_usedDisk="$backup_usedDisk - if [ $root_totalSize = $backup_totalSize -a $root_freeDisk = $backup_freeDisk -a $root_usedDisk = $backup_usedDisk ]; then #"/backup"是不是一个独立的盘 + if [[ $root_totalSize = $backup_totalSize && $root_freeDisk = $backup_freeDisk && $root_usedDisk = $backup_usedDisk ]]; then #"/backup"是不是一个独立的盘 echo "Cannot find the /backup disk or not be mounted!" exit 403 fi @@ -611,6 +611,11 @@ backuping() { # rsync -av --ignore-missing-args ${src}/boot/efi ${dst}/boot #fi + echo "Begin to backup..." >>$PLOGFILE + echo "Begin to backup..." + + mkdir -p ${rootpath}/var/log + touch ${rootpath}/var/log/backup.log #是否有数据分区 if [ $hasDataPartition -eq 0 ]; then #exclude的必须是相对目录,其实在efi启动时为/root/data @@ -618,14 +623,14 @@ backuping() { #rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst #不是目录,也不备份 - echo rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >/dev/null 2>${rootpath}/var/log/backup.log - rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >/dev/null 2>${rootpath}/var/log/backup.log + echo rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >>${rootpath}/var/log/backup.log 2>&1 + rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >>${rootpath}/var/log/backup.log 2>&1 else #exclude的必须是相对目录,其实在efi启动时为/root/data #echo rsync -avAXH --ignore-missing-args --exclude data --exclude-from=$EXCLUDEFILE $src $dst #The question is that the 'data' directories can not be copied - echo rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >/dev/null 2>${rootpath}/var/log/backup.log - rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >/dev/null 2>${rootpath}/var/log/backup.log + echo rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >>${rootpath}/var/log/backup.log 2>&1 + rsync -avAXH --ignore-missing-args --exclude-from $EXCLUDEFILE $src $dst >>${rootpath}/var/log/backup.log 2>&1 fi if [ $? -eq 0 -o $? -eq 24 -o $? -eq 23 ]; then @@ -654,6 +659,9 @@ backuping() { #写日志文件 writeLogFile "${m_time},${m_uuid},0,出厂备份,${newSize}" #grub时只有全盘备份,没有增量备份 + echo "sync..." >>$PLOGFILE + sync + echo "Backup end..." >>$PLOGFILE } CreateUuid() { @@ -1031,6 +1039,7 @@ elif [ $backupORrestore = "--autorestore" ]; then elif [ $backupORrestore = "--factorybackup" ]; then m_isFactory=true mountBackup + mount >>$PLOGFILE backupAuto #备份, grub时只有全盘备份,没有增量备份 updateBackupAutoFinishedState #umountBackup diff --git a/backup-daemon/data/backup-auto-efi b/backup-daemon/data/backup-auto-efi index 9705c10..47e3e85 100755 --- a/backup-daemon/data/backup-auto-efi +++ b/backup-daemon/data/backup-auto-efi @@ -445,7 +445,7 @@ checkBackupCapacity() { #(m_rootPath.toStdString().c_str(), retstatus)) #echo "--backup_freeDisk="$backup_freeDisk #echo "--backup_usedDisk="$backup_usedDisk - if [ $root_totalSize = $backup_totalSize -a $root_freeDisk = $backup_freeDisk -a $root_usedDisk = $backup_usedDisk ]; then #"/backup"是不是一个独立的盘 + if [[ $root_totalSize = $backup_totalSize && $root_freeDisk = $backup_freeDisk && $root_usedDisk = $backup_usedDisk ]]; then #"/backup"是不是一个独立的盘 echo "Cannot find the /backup disk or not be mounted!" exit 12 fi