#!/bin/bash

DESC="Purge du cache eole-guardian"

proxy=$(CreoleGet activer_filtrage_proxy)
cacheAge=1

if [[ ${proxy} = 'oui' ]]
then
    path_proxy=$(CreoleGet container_path_proxy)
	set -e
	for instance in 0 1 2
	do
		active=$(CreoleGet dans_instance_$((instance+1))_active non)
		if [[ ${active} = 'oui' ]]
		then
			cache=$(CreoleGet dans_cachedir$((instance+1)))
			find ${path_proxy}${cache} -type f -mtime +${cacheAge} -exec rm {} \;
		fi
	done
	set +e
fi
