Script to execute a shell script/command when a directory size is large than value.

Medical Technology, Healthcare & Government IT

.
Categories
Category Groups

Created a script for clearing Drupal cache to reduce MySQL database Size. When database size is large than 800MB it will execute the page cache_clear.php for clearing cache.

#!/bin/bash
du -hs /var/lib/mysql/alim | grep ^[8-9][0-9][0-9.]*M
#u -hs /var/lib/mysql | grep ^[4-9][0-9.]*M
if [ $? -eq 0 ]; then
echo "The size exeeds....!!!! Clearing drupal cache....!!!"
cd /usr/share/nginx/www/www.alim.org/
/usr/bin/php cache_clear.php
else
echo "Normal"
fi

celebrex buy online, dapoxetine without prescription

Original Link