shell script to delete /tmp files linux leaving eacclarator folder

Hi,

 

You can use this script to delete tmp files if the /tmp partition memory goes beyond 70 percent by leaving eacclarator folder alone,

 

#/bin/bash

#Script to delete tmp files except eacclarator
s=df -h |grep tmp | cut -d. -f1
if [ $s -gt 70 ];
then
if [ `ls /tmp |grep eacclarator |wc -l` -gt 0 ]; # will delete under eacclarator folder
then
rm -rf /tmp/eacclarator/*
/etc/init.d/httpd restart #to make eacclarator to recreate its default folders.
exit
fi
rm -f /tmp/*
exit
fi

Leave a Reply

Protected by WP Anti Spam