I am trying to save my folders (except some) in /var/www with logrotate daily, weekly and monthly.
I try, in the postrotate, to do something like
cd /var/www/
for i in $(ls -d */); do echo ${i%%/}; done | \
grep -Ev '(clients)|(conf)|(ispconfig)|(php-fcgi-scripts)|(webalizer)|(webmail)' | \
while read dirname; do \
tar cvfz /my/backup/dir/"$dirname".tgz -C /var/www/"$dirname".com/web/ . \
done
because I will add many websites and I think that to have a specific logrotate conf file per website is an error source. Of course this doesn't work because logrotate waits for one and only one output file to rotate, and the tgz I create will not be rotated.
Does anyone have an idea how to do it cleanly/safely?
Thank you so much.