Skip to content

Commit 2778d11

Browse files
authored
Merge pull request SensorsIot#195 from 877dev/20201210-docker_backup_fix
2020-12-10-docker_backup.sh folder fix
2 parents 60fb567 + 9b10412 commit 2778d11

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/docker_backup.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,23 @@ if [ -f ./backups/dropbox ]; then
6666

6767
#upload new backup to dropbox
6868
echo "uploading to dropbox"
69-
$dropboxuploader upload ./backups/$backupfile $backupfile
69+
$dropboxuploader upload ./backups/$backupfile $dropboxfolder/$backupfile
7070

71-
#list older files to be deleted from cloud (exludes last 7)
72-
#to change dropbox backups retained, change below -7 to whatever you want
71+
#list older files to be deleted from cloud (exludes last 30)
72+
#to change dropbox backups retained, change below -30 to whatever you want
7373
echo "checking for old backups on dropbox"
74-
files=$($dropboxuploader list $dropboxfolder | awk {' print $3 '} | tail -n +2 | head -n -7)
74+
files=$($dropboxuploader list $dropboxfolder | awk {' print $3 '} | tail -n +2 | head -n -30)
7575

7676
#write files to be deleted to dropbox logfile
7777
sudo touch $dropboxlog
7878
sudo chown $USER:$USER $dropboxlog
7979
echo $files | tr " " "\n" >$dropboxlog
8080

8181
#delete files from dropbox as per logfile
82-
echo "deleting old backups from dropbox if they exist - last 7 files are kept"
82+
echo "deleting old backups from dropbox if they exist - last 30 files are kept"
8383

8484
#check older files exist on dropbox, if yes then delete them
85-
if [ $( echo "$files" | grep -c "backup") -ne 0 ] ; then
85+
if [ $( echo "$files" | grep -c "backup") -ne 0 ] ; then
8686
input=$dropboxlog
8787
while IFS= read -r file
8888
do

0 commit comments

Comments
 (0)