Operating System - HP-UX
1753546 Members
5577 Online
108795 Solutions
New Discussion юеВ

Re: help in shell scripting

 
SOLVED
Go to solution
DKC
Advisor

help in shell scripting

Hi,

Can any one help me for creating the shell scripting in which i run the cron job and hold only those file system in which 70% full.

Appreciate the prompt support.

Thanks & Regards,
Dev
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: help in shell scripting

Hi Dev:

A search of this forum will unearth many threads of this kind, including:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1178106

Regards!

...JRF...
Ishwar_1
Frequent Advisor

Re: help in shell scripting


Hello,

U can use this script in cron which will update u the Filesystem size with the date.

#/bin/sh
#
echo " " >> /tmp/script/filesystem.log
echo " " >> /tmp/script/filesystem.log
date >> /tmp/script/filesystem.log
echo "=================================" >> /tmp/script/filesystem.log
bdf | awk '{if($5 > 70)print $5, " ", $6}' >> /tmp/script/filesystem.log

Hope this should solve your problem

Regards
Ishwar
Tingli
Esteemed Contributor

Re: help in shell scripting

My suggestion:

#!/usr/bin/ksh
USED=$(df -k $file_system | head -3 | tail -1 | awk '{print $1}')
TOTAL=$(df -k $file_system | head -1 | awk -F: '{print $2}' |awk '{print $1}')
if [[ $(($USED*100/$TOTAL)) -gt 70 ]]
then
hold
fin
DKC
Advisor

Re: help in shell scripting

Hi JRF,

I am sorry to delay the response. I was busy with otherwork. Really the URL is so worthfull. Thanks to all for suggesting me to right approach.

Regards,
Dev