Posts

Showing posts from December, 2015

crontab entry with date command

crontab -l */1 * * * * sh /Davinder/Scripts/disk_wrap.sh First script to just create log files:    [root@linuxhost logs]# cat /Davinder/Scripts/disk_wrap.sh #!/bin/bash sh /Disk_full.sh >/Davinder/Scripts/logs/disk_full.log_`date +%d%m%^C%H%M%S` Main script --> /Disk_full.sh   #!/bin/bash DISK_USAGE=`df -TH | grep -w "/"|awk '{print $5+0}'` #a=`echo ${DISK_USAGE%%.*}` #echo "$DISK_USAGE" a=${DISK_USAGE:0:2} #echo $a if [ $a -gt 95 ]; then                 echo "It is more than 96%..Cleaning Disk"                 echo 0 > /var/log/httpd/error_log #               sleep 10                 Disk_Check=`df -TH | grep -w "/"|awk '{print $5+0}'`    ...

Script: Clean log file after "/" crossed 95% usage.

#!/bin/bash DISK_USAGE=`df -TH | grep -w "/"|awk '{print $5+0}'` #a=`echo ${DISK_USAGE%%.*}` #echo "$DISK_USAGE" a=${DISK_USAGE:0:2} #echo $a if [ $a -gt 95 ]; then                 echo "It is more than 96%..Cleaning Disk"                 echo 0 > /var/log/httpd/error_log #               sleep 10                 Disk_Check=`df -TH | grep -w "/"|awk '{print $5+0}'`                         if [ $a -gt 96 ];                              ...