瀏覽代碼

Optionally remove existing usb backup before starting new one

Bob Mottram 9 年之前
父節點
當前提交
41c0b628dd
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 二進制
      man/freedombone-backup-local.1.gz
  2. 12
    0
      src/freedombone-backup-local

二進制
man/freedombone-backup-local.1.gz 查看文件


+ 12
- 0
src/freedombone-backup-local 查看文件

189
     fi
189
     fi
190
 }
190
 }
191
 
191
 
192
+function remove_backup_directory {
193
+    if [ $1 ]; then
194
+        if [[ $1 == "remove" ]]; then
195
+            if [ ! -d $USB_MOUNT/backup ]; then
196
+                rm -rf $USB_MOUNT/backup
197
+                echo 'Existing backup directory removed'
198
+            fi
199
+        fi
200
+    fi
201
+}
202
+
192
 function check_storage_space_remaining {
203
 function check_storage_space_remaining {
193
     # Check space remaining on the usb drive
204
     # Check space remaining on the usb drive
194
     used_percent=$(df -k $USB_MOUNT | tail -n 1 | awk -F ' ' '{print $5}' | awk -F '%' '{print $1}')
205
     used_percent=$(df -k $USB_MOUNT | tail -n 1 | awk -F ' ' '{print $5}' | awk -F '%' '{print $1}')
324
 }
335
 }
325
 
336
 
326
 mount_drive $1 $2
337
 mount_drive $1 $2
338
+remove_backup_directory $2
327
 make_backup_directory
339
 make_backup_directory
328
 check_storage_space_remaining
340
 check_storage_space_remaining
329
 backup_users
341
 backup_users