Thursday, 31 December 2015

Shell scripts


1.Disk alert filesystem > 90

df -k | sed s/%//g | awk '{if($4 > 90) print $0}' 

2.Month number should not start with zero
For ex: date +%m -- 09   need to print it as 9

date +%m | sed 's/^0//g'

3.If the file size is more than 0 KB then should get an alert
 if [[ -s $FILENAME ]] ; then
echo "$FILE has data." | mails -s "Filesize more than 0KB" mail@gmail.com
else
echo "$FILE is empty."
fi ;

4.

No comments:

Post a Comment