]> git.p6c8.net - nextcloud-backup-restore.git/commitdiff
Small improvements
authorDecaTec <jr@decatec.de>
Fri, 12 Apr 2019 12:07:37 +0000 (14:07 +0200)
committerDecaTec <jr@decatec.de>
Fri, 12 Apr 2019 12:07:37 +0000 (14:07 +0200)
NextcloudBackup.sh
NextcloudRestore.sh

index aeb31fb3c185f20870ce31cbbb550891a4c4d030..f433a8d9b4653ccebeeb9473e6a65a926e1da173 100644 (file)
@@ -183,16 +183,16 @@ DisableMaintenanceMode
 #
 # Delete old backups
 #
-if (( ${maxNrOfBackups} != 0 ))
+if [ ${maxNrOfBackups} != 0 ]
 then
        nrOfBackups=$(ls -l ${backupMainDir} | grep -c ^d)
 
-       if (( ${nrOfBackups} > ${maxNrOfBackups} ))
+       if [[ ${nrOfBackups} > ${maxNrOfBackups} ]]
        then
                echo "Removing old backups..."
-               ls -t ${backupMainDir} | tail -$(( nrOfBackups - maxNrOfBackups )) | while read dirToRemove; do
+               ls -t ${backupMainDir} | tail -$(( nrOfBackups - maxNrOfBackups )) | while read -r dirToRemove; do
                        echo "${dirToRemove}"
-                       rm -r ${backupMainDir}/${dirToRemove}
+                       rm -r "${backupMainDir}/${dirToRemove:?}"
                        echo "Done"
                        echo
                done
index 1669a181d3925943dbaba40930ab6173186e2841..06610d588a50090295062f72918cf4d93a2eab51 100644 (file)
@@ -99,9 +99,7 @@ fi
 # Set maintenance mode
 #
 echo "Set maintenance mode for Nextcloud..."
-cd "${nextcloudFileDir}"
-sudo -u "${webserverUser}" php occ maintenance:mode --on
-cd ~
+sudo -u "${webserverUser}" php ${nextcloudFileDir}/occ maintenance:mode --on
 echo "Done"
 echo
 

patrick-canterino.de