#!/bin/bash
[ -d  /var/cache/nginx/ ] || { echo "nginx not installed" ; exit ; } 
[ -d  /var/cache/nginx/ ] && { echo "...." ; if ! ps auwfx| grep -v grep  |grep find | grep engintron ; then 
        echo "Deleting all nginx cache" ;  
        find /var/cache/nginx/engintron_dynamic/ -type f | xargs rm -rvf
        find /var/cache/nginx/engintron_static/ -type f | xargs rm -rvf
        find /var/cache/nginx/engintron_temp/ -type f | xargs rm -rvf
fi ;echo "[ Done ]" ; } || { exit ; echo "Cache not removed, process already running [OK]" ;  } 
