From owner-freebsd-questions@FreeBSD.ORG Mon Sep 15 12:28:56 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2223116A4BF for ; Mon, 15 Sep 2003 12:28:56 -0700 (PDT) Received: from remt23.cluster1.charter.net (remt23.cluster1.charter.net [209.225.8.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0101C43FBD for ; Mon, 15 Sep 2003 12:28:55 -0700 (PDT) (envelope-from chowse@charter.net) Received: from [66.168.145.25] (HELO moe) by remt23.cluster1.charter.net (CommuniGate Pro SMTP 4.0.6) with ESMTP id 159559097 for freebsd-questions@freebsd.org; Mon, 15 Sep 2003 15:28:54 -0400 From: "Charles Howse" To: Date: Mon, 15 Sep 2003 14:28:48 -0500 Message-ID: <003801c37bbf$964b67c0$04fea8c0@moe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: RE: drive space shell script help ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Sep 2003 19:28:56 -0000 The more I play with your script, the more fun it becomes. #!/bin/sh # this is a script to check drive space and email HSD dept. # cd ~bbailey rm drvspc.txt # Once I'm in ~bbailey, I don't need the complete path to any files there. df -k |=20 # You have to get rid of the word 'Capacity' or your comparison will fail, grep -v Capacity | # There's no need to check the /proc filesystem, it'll always be full, grep -v /proc |=20 awk '{print$5}' |=20 # You have to use sed to eliminate the % from df -k or the comparison will fail. sed -e 's/%//' > drvspc.txt=20 cat drvspc.txt |=20 while read i do if [ $i -gt 89 ] ; then mail -s "check drive space on core" bbailey@whatever.com fi done # Quotes not necessary when echoing a single word, but I wouldn't do this, you # might want to schedule this with cron and it'll clutter up your screen # if you tell it to say 'done' every time it runs. echo done=20 exit 0 Thanks, Charles Got a computer with idle CPU time? Join SETI@home and help make history! http://setiathome.ssl.berkeley.edu/