The situation of the file system full for /usr/sap is frequently met. Probably that the first thing that any admin would do is to check if he can cleanup any core files on the FS.
In order to have an overview and also to avoid this manual check/cleanup, I created a script to check the existence, time stamp and size of such file and send this information via email.
Also if the file is older than seven days this will be deleted, having enough time to analyze the cause for the generation of the file.
Here is how the script looks like:
#!/usr/bin/ksh cd /usr/sap/SID/DVEBMGS*/work FILE1=$(ls -l core |grep -v grep | grep -cw core) FILE2=$(find . -name core -mtime +7 | grep -v grep | grep -cw core) if [ $FILE1 != 0 ] then echo "There is : $(ls -l | grep -cw core) core with the name : $(ls -l core) and size : $(du -h core) space left on FS : $(df -h core) $(hostname), $(date)" | /usr/lib/sendmail -v email@domain.com else echo "no core - do nothing" fi if [ $FILE2 != 0 ] then (rm core) && (echo "A core file older than one week has been deleted on $(hostname), $(date)" : [$(ls -l core)]) | /usr/lib/sendmail -v email@domain.com else echo "no core older than one week" fi
This is how such an email should look like, if any cores are found:
There is : 1 core with the name : -rw------- 1 sidadm sapsys 90001069 Mar 19 16:12 core and size : 86M core space left on FS : Filesystem size used avail capacity Mounted on hostname:/usr/sap 1.0G 175M 849M 18% /home/sidadm hostname, Thu Mar 24 10:10:00 CET 2017
ga(‘create’, ‘UA-103593792-1’, ‘auto’);
ga(‘send’, ‘pageview’);
Related