====== /etc/cron.daily/freefilesync-logs ====== #! /bin/bash PATH=/bin:/usr/bin export PATH # Restrict the number of log files pro host backed up b # FreeFilesync. DEBUG="true" # Uncomment the following line to just show that would be done #DEBUG="echo" # Location of log directories DIR=/buchleitner # Maximum number of log files to save MAX=30 LOGDIRS=`ls -d $DIR/*/*.log` for i in $LOGDIRS; do $DEBUG Processing $i: #ls -1 $i/* | wc -l ls $i/* | head --lines=-$MAX | while read x; do $DEBUG rm "$x" done $DEBUG done