Update pibackup.sh

This commit is contained in:
2022-10-08 16:07:41 -05:00
parent f8565146db
commit 754aa9ebbc

View File

@@ -10,16 +10,29 @@ if [ "$1" != "update" ]; then
BackupDir=/mnt/veeam-backups/octopi
logfile=/opt/idssys/pibackup/logfile
#echo
echo '-----------------------------------------------------------------------'
#date
echo '-----------------------------------------------------------------------'
echo
echo '----------------------------------------------------------------------------------------------------'
date
echo '----------------------------------------------------------------------------------------------------'
if grep '/dev/nvme0n1' /etc/mtab > /dev/null 2>&1; then dtype=/dev/nvme0n1
elif grep '/dev/mmcblk0' /etc/mtab > /dev/null 2>&1; then dtype=/dev/mmcblk0
fi
echo "$(date) - Checking for mounted Backup Drive..."
if [ ! -f ${MountPoint}/mounted ]; then
echo "$(date) - Not found, mounting drive now..."
mount.cifs ${ServerName} ${MountPoint} -o user=${UserName},password=${Password}
sleep 15s
if [ ! -f ${MountPoint}/mounted ]; then
echo "$(date) - Backup Drive mounted"
else
echo "$(date) - Backup Drive COULD NOT be mounted... exiting"
exit 1
fi
else
echo "$(date) - Backup Drive already mounted"
fi
#[ ! -d "$MountPoint" ] && mkdir -p "$MountPoint"
[ ! -d "$BackupDir" ] && mkdir -p "$BackupDir"
@@ -43,10 +56,10 @@ if [ "$1" != "update" ]; then
if [ $i == $a ]; then keep=1;fi;
done;
if [ $keep == 0 ]; then
echo "$(date) - REMOVE: $i"
echo "$(date) - REMOVING : $i"
#rm -rf $i
else
echo "$(date) - KEEP : $i"
echo "$(date) - KEEPING : $i"
fi
done
#echo