Update pibackup.sh
This commit is contained in:
27
pibackup.sh
27
pibackup.sh
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user