Operating System - Linux
1827862 Members
1462 Online
109969 Solutions
New Discussion

Need a script that emails the disk utilization outputs every 15 minutes

 
Dawit Worku
New Member

Need a script that emails the disk utilization outputs every 15 minutes

Hi Everyone,

I need a script that emails the disk utilization outputs every 15 minutes. Any other way to do it besides scheduling it via cron?
4 REPLIES 4
Tim Nelson
Honored Contributor

Re: Need a script that emails the disk utilization outputs every 15 minutes

##runs 5 sar status, emails output,sleeps for 15min, then repeats forever.

while true
do
sar -d 5 5 |mailx -s "Disk Stats" you@somewhere.com
sleep 900
done
Steven Schweda
Honored Contributor

Re: Need a script that emails the disk utilization outputs every 15 minutes

> [...] besides scheduling it via cron?

Why _not_ use "cron"? Too simple? Too
reliable? Why exclude what is probably the
best available method?


> sleep 900

And, if the other work takes exactly no time,
then it'll happen every 900 seconds. Unless
the script dies for any reason at all.
Dawit Worku
New Member

Re: Need a script that emails the disk utilization outputs every 15 minutes

Thanks Tim. It worked like charm
Dawit Worku
New Member

Re: Need a script that emails the disk utilization outputs every 15 minutes

The reply worked great. It was exactly what I needed.