[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 100% [Waiting for headers]



On Sunday, June 24, 2012 01:28:28, lina wrote:
> On Sun, Jun 24, 2012 at 12:49 PM, Chris Knadle <Chris.Knadle@coredump.us> wrote:
> > On Saturday, June 23, 2012 23:49:54, lina wrote:
> >> Kinda of funny,
> >> 
> >> Dselect reported me that my /var has saturated.  Indeed, 100%.
> >> 
> >> My question is that how to set to let me know earlier when the var
> >> reached 98%.  Kinda of dangerous huh?
> > 
> > This is a common problem.  If this is a box you're running KDE on I'd
> > suggest the freespacenotifier package.  If this is a server (or doesn't
> > run KDE) then
> 
> It runs with xfce4.
> 
> > I'd suggest configuring the box such that you'll get email output from
> > cron, and then make a cronjob that outputs text only when the free space
> > left on filesystems reaches the desired "warning" threshold.
> 
> I started to initiate a script,
> 
> $ while [ df -h | grep "/dev/sda11 " | awk '{print $5}' > 90% ]; do
> sleep 1000 ; done mail lina@email.com
> bash: [: missing `]'
> bash: 90%: No such file or directory
> 
> not work.
> 
> Can someone recommend some build-in script which integrate the cron,
> so I can take it as template and learn from it. I don't know which one
> is the best fit, which also autorun everytime after reboot.

This evening I came up with the following quick script, "freespacewarn",
which I placed in my home directory under ~/bin :


--------------------------------------------
#!/bin/bash

df -h | fgrep -v -e Filesystem | while read FS SIZE USED AVAIL PCNT_USE MOUNTEDAT JUNK
do
   export PCNT_USE
   PCNT=$(echo $PCNT_USE | tr -d '%')
   if [ $PCNT -gt 90 ]; then
      echo "Warning: filesystem at $MOUNTEDAT nearly full."
      echo "  Filesystem $FS, Size $SIZE, $USED used, $AVAIL avail, $PCNT_USE used, mounted at $MOUNTEDAT"
   fi
done
--------------------------------------------


Then I made a user crontab entry via 'crontab -e' to run this once a day
at 7am:

0 7 * * * /home/cknadle/bin/freespacewarn


  -- Chris

--
Chris Knadle
Chris.Knadle@coredump.us


Reply to: