Hello Everyone,
I'm struggiling with backup issues and need to sum up sizes of backup files monthly and add the result to the next month's sum recursively.
For this i have a well working script that i modified as i showed below and this part gives the sum of the file sizes under working directory. Using this i want to add each months' SUM recursively. When the SUM reaches a spesific value like %70 and %90 of a size of a magnetic tape i should give a warning (email probably) and then the SUM will be reset to zero. How can i use the script in a loop, could u please help, im not used to Looping.
a=$`find . \( -name "*.tar" -o -name "*.gz" \) -mtime +1 -exec ls -l {} \; | awk '/^-/ {total += $5} END {printf "%15.2f\n",total}'` |
printf "SUM_OF_SIZE_OF_ALL_FILES=$a" >> SUM_OF_FILES.txt; | |
### can i use the last part of the script again to sum up the every month's result by getting the result from recorded file by "cat"? ###
cat SUM_OF_FILES.txt > awk '/^-/ {total +=
$5} END {printf "%15.2f\n",total}'##as the sum value is in .txt the $5 part should be change as $0 or $1?##
if ["$a" -eq 50000000 ]; then ...
### i dont know how to calculate %70-90 of a value so i assigned a direct value here###
printf " ----ATTENTION!! 50 GBYTE or %70 of TAPE DRIVE IS FULL ----- ";
sendmail -bd .......
fi
if ["$a" -ge 70000000 ] ; then
printf " ----ATTENTION!! 70 GBYTE or %90 of TAPE DRIVE IS FULL ----- ";
sendmail -bd .......
$a == 0
fi
thanks in advanced..