rcopy.sh: remount backup partition if backup partion is mounted, but mount point is not the defined one.
This commit is contained in:
		
							
								
								
									
										56
									
								
								rcopy.sh
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								rcopy.sh
									
									
									
									
									
								
							| @@ -150,31 +150,39 @@ if $extern_usb_disk || $extern_sata_disk || $intern_disk ; then | ||||
|    ## - Backup Device mounted ? | ||||
|    ## - | ||||
|    if ! df | grep "$backup_partition" > /dev/null 2>&1 ;then | ||||
|  | ||||
|       if $crypto_backup_device ;then | ||||
|          $cryptsetup --key-file $crypto_key_file  luksOpen $backup_raw_partition $backup_partition_name > /dev/null 2>&1 | ||||
|       fi | ||||
|       mount $mount_flags $backup_partition $backup_mountpoint > /dev/null 2>&1 | ||||
|    fi | ||||
|       sleep 5 | ||||
|  | ||||
|    sleep 2 | ||||
|    if ! df | grep "$backup_partition" > /dev/null 2>&1 ;then | ||||
|       msg="[ Error ]: Cannot mount Backup Partion \"$backup_partition\". exiting now.." | ||||
|    elif ! $(df -h | grep $backup_partition | grep -q $backup_mountpoint 2> /dev/null) ; then | ||||
|  | ||||
|       msg="[ Warning ]: Backup Partition is mounted, but mount point differs from script defined one ($backup_mountpoint)." | ||||
|       msg="$msg\n             Try to unmount partitionn and mount it again.." | ||||
|       if $MANUAL ; then | ||||
|          echo -e "\n$msg\n" | ||||
|       else | ||||
|          datum=`date +"%d.%m.%Y"` | ||||
|          echo -e "To:${admin_email}\n${content_type}\nSubject:Backup Errors $company -- $datum\n${msg}\n" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email | ||||
|       fi | ||||
|       exit 1 | ||||
|       echolog "\n[ Warning ]: Backup Partition is mounted, but mount point differs from script defined one  | ||||
|              which is '$backup_mountpoint'.\n\n             Try to unmount partition and mount it again.." | ||||
|  | ||||
|       $umount $backup_partition > /dev/null 2>&1 | ||||
|       sleep 5 | ||||
|  | ||||
|       mount $mount_flags $backup_partition $backup_mountpoint > /dev/null 2>&1 | ||||
|       sleep 5 | ||||
|  | ||||
|    fi | ||||
|  | ||||
|  | ||||
| elif $remote_disk ; then | ||||
|  | ||||
|    if ! df | grep "$backup_mountpoint" > /dev/null 2>&1 ;then | ||||
|       mount "$backup_mountpoint" > /dev/null 2>&1 | ||||
|       sleep 5 | ||||
|    fi | ||||
|  | ||||
|    sleep 2 | ||||
|    if ! df | grep "$backup_mountpoint" > /dev/null 2>&1 ;then | ||||
|       msg="[ Error ]: Mounting remote disk to '$backup_mountpoint' failed. exiting now.." | ||||
|       if $MANUAL ; then | ||||
| @@ -185,24 +193,10 @@ elif $remote_disk ; then | ||||
|       fi | ||||
|       exit 1 | ||||
|    fi | ||||
|  | ||||
| #elif $check_mountpoint ; then | ||||
| #   if ! df | grep "$backup_mountpoint" > /dev/null 2>&1 ;then | ||||
| #      msg00="[ Error ]: Mountpoint \"$backup_mountpoint\" for Backup Partion \"$backup_partition\" not found.\n" | ||||
| #      msg01="           exiting now.." | ||||
| #      msg="${msg00}\n${msg01}" | ||||
| #      if $MANUAL ; then | ||||
| #         echo -e "\n$msg\n" | ||||
| #      else | ||||
| #         datum=`date +"%d.%m.%Y"` | ||||
| #         echo -e "To:${admin_email}\nSubject:Backup Errors $company -- $datum\n${msg}\n" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email | ||||
| #      fi | ||||
| #      exit 1 | ||||
| #   fi | ||||
| fi | ||||
|  | ||||
| if $extern_usb_disk || $extern_sata_disk || $intern_disk || $remote_disk ; then | ||||
|    sleep 2 | ||||
|  | ||||
|    if ! df | grep "$backup_partition" > /dev/null 2>&1 ;then | ||||
|       msg="[ Error ]: Cannot mount Backup Partion \"$backup_partition\". exiting now.." | ||||
|       if $MANUAL ; then | ||||
| @@ -212,9 +206,19 @@ if $extern_usb_disk || $extern_sata_disk || $intern_disk || $remote_disk ; then | ||||
|          echo -e "To:${admin_email}\n${content_type}\nSubject:Backup Errors $company -- $datum\n${msg}\n" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email | ||||
|       fi | ||||
|       exit 1 | ||||
|  | ||||
|    elif ! $(df -h | grep $backup_partition | grep -q $backup_mountpoint 2> /dev/null) ; then | ||||
|  | ||||
|       msg="[ Error ]: Backup Partition is mounted, but mount point differs from script defined one ($backup_mountpoint)." | ||||
|       if $MANUAL ; then | ||||
|          echo -e "\n$msg\n" | ||||
|       else | ||||
|          datum=`date +"%d.%m.%Y"` | ||||
|          echo -e "To:${admin_email}\n${content_type}\nSubject:Backup Errors $company -- $datum\n${msg}\n" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email | ||||
|       fi | ||||
|       exit 1 | ||||
|    fi | ||||
| fi | ||||
|     | ||||
| fi  | ||||
|  | ||||
|  | ||||
| ## - $AGENT muss  (root) geh<65>ren und darf nicht beschreibbar sein | ||||
|   | ||||
		Reference in New Issue
	
	Block a user