Browse Source

update autodeleter script

ChesTeRcs 5 years ago
parent
commit
1527074284
1 changed files with 6 additions and 3 deletions
  1. 6 3
      autoDeleterBelowSpace.sh

+ 6 - 3
autoDeleterBelowSpace.sh

@@ -38,19 +38,22 @@ then
         then
             if rm -f $FILE
             then
-                echo "Deleted $FILE"
+                now=$(date)
+                echo "${now}: Deleted $FILE" >> /var/log/ftpDeleter.log
 
                 CAPACITY=$(df -k . | awk '{gsub("%",""); capacity=$5}; END {print capacity}')
 
                 if [ $CAPACITY -le $CAPACITY_LIMIT ]
                 then
                     # we're below the limit, so stop deleting
-                    echo "Below limit, stopped deleting."
+                    now=$(date)
+                    echo "${now}: Below limit, stopped deleting. Capacity: ${CAPACITY}" >> /var/log/ftpDeleter.log
                     exit
                 fi
             fi
         fi
     done
 else
-    echo "Don't need to delete anything, capacity: ${CAPACITY}"
+    now=$(date)
+    echo "${now}: Don't need to delete anything, capacity: ${CAPACITY}"
 fi