From d75aca2ebaadb83c1a1b9793a65d13048411dbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 6 Sep 2016 23:39:49 +0200 Subject: Fix backup script I should have use unix time from beginning. --- local/bin/system-backup | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'local/bin/system-backup') diff --git a/local/bin/system-backup b/local/bin/system-backup index 06929c1..a01a78e 100755 --- a/local/bin/system-backup +++ b/local/bin/system-backup @@ -25,8 +25,13 @@ if [ -z "$PART" ]; then exit -1 fi MPATH=$(lsblk -lp | grep "$PART" | awk '{print$7}') -# TODO check if this is not in backupped path if [ -n "$MPATH" ]; then + while read -r DIR; do + if echo "$MPATH" | grep -q "$DIR"; then + echo Disk seems to be mounted to one of backuped paths. Please unmount it first. + exit -2 + fi + done <<< "$DIRS" echo Disk already mounted to $MPATH. Continuing with that. else MPATH=$MBACKUP @@ -50,7 +55,7 @@ if [ "$MBACKUP" = "$MPATH" ]; then umount "$MPATH" fi -date +"%Y%m%d" > /home/cynerd/.backup_date +date +"%s" > /home/cynerd/.backup_date pkill -RTMIN+13 i3blocks sync -- cgit v1.2.3