dear all.
i'm a dba and i'm newbie with awk but im ready to give up with this --> :S .
So, i want to schedule a task in crontab at solaris that send e-mail message ONLY if the amount of GB in my filesystems exceeds the threshold configured.
The problem is that every execution (either exceeds or no the threshold) i receive an e-mail message, and ONLY i have to received message if the GB used is more than threshold that i putted.
Here are my lines of my script sh:
#------------------------------------START----------------------------------------
FEC_REPORT=`date "+%m/%d/%y %k:%M"`
export MAILTO="algo@dominio.com"
FS_LIMIT=$1
FS_GT=`df -k|grep -v boot|grep -v shm|awk '{print $5" "$6}' |/usr/xpg4/bin/awk -F"%" -v fs_limit=${FS_LIMIT} '$1 > fs_limit {print $1"%--->"$2}'`
if [ -n "${FS_GT}" ]
then
echo "${FS_GT}"|mailx -s "EMPRESA : File systems on `hostname` reached ${FS_LIMIT} USED: ${FEC_REPORT}" ${MAILTO}
fi
#--------------------------------------END--------------------------------------
i executed the script in this way: script.sh 80, where 80 is the threshold.
Please i need your help.
Thanks.
zipimon
i'm a dba and i'm newbie with awk but im ready to give up with this --> :S .
So, i want to schedule a task in crontab at solaris that send e-mail message ONLY if the amount of GB in my filesystems exceeds the threshold configured.
The problem is that every execution (either exceeds or no the threshold) i receive an e-mail message, and ONLY i have to received message if the GB used is more than threshold that i putted.
Here are my lines of my script sh:
#------------------------------------START----------------------------------------
FEC_REPORT=`date "+%m/%d/%y %k:%M"`
export MAILTO="algo@dominio.com"
FS_LIMIT=$1
FS_GT=`df -k|grep -v boot|grep -v shm|awk '{print $5" "$6}' |/usr/xpg4/bin/awk -F"%" -v fs_limit=${FS_LIMIT} '$1 > fs_limit {print $1"%--->"$2}'`
if [ -n "${FS_GT}" ]
then
echo "${FS_GT}"|mailx -s "EMPRESA : File systems on `hostname` reached ${FS_LIMIT} USED: ${FEC_REPORT}" ${MAILTO}
fi
#--------------------------------------END--------------------------------------
i executed the script in this way: script.sh 80, where 80 is the threshold.
Please i need your help.
Thanks.
zipimon