<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FileSystemAlert Script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022872#M5652</link>
    <description>sorry... didn't read your entire post before i posted my last post...</description>
    <pubDate>Mon, 14 Jul 2003 13:21:07 GMT</pubDate>
    <dc:creator>John Meissner</dc:creator>
    <dc:date>2003-07-14T13:21:07Z</dc:date>
    <item>
      <title>FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022867#M5647</link>
      <description>Gents- The following script i have below for some reason isn't running. I use 60 % in my script just for testing purposes to see if it works since I currently have no file system even 90 % full. Can somebody please help me to see why this isn't running? I have it set in the crontab to run hourly. Thanks&lt;BR /&gt;&lt;BR /&gt;Kyle&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#Script Name: FileSystemAlert&lt;BR /&gt;#Author: Cpl Harris&lt;BR /&gt;#Date: July 10, 2003&lt;BR /&gt;#Purpose: To send out an email alerting admin when a filesystem is over 97 %&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mark=1&lt;BR /&gt;while [ $mark = 1 ]&lt;BR /&gt;do&lt;BR /&gt;df | grep -v Filesystem |&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;MTP=$(echo "$line" | awk '{print $6}')&lt;BR /&gt;USE=$(echo "$line" | awk '{print $5}' | sed 's/.$//g')&lt;BR /&gt;if [ "$USE" &amp;gt; "60" ]&lt;BR /&gt;then&lt;BR /&gt;echo "$MTP $USE " | mail -s "FS alert" harriskd@mcsc.usmc.mil&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;else&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Jul 2003 12:39:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022867#M5647</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-14T12:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022868#M5648</link>
      <description>what kind of error do you get from this script?&lt;BR /&gt;I think that /usr/bin/sh (first line) isn't the correct path for the shell interpreter. In my system (Redhat 73) I must use /bin/sh.&lt;BR /&gt;I made this correction and the script seems to work (I executed it manually, not by cron).&lt;BR /&gt;&lt;BR /&gt;You can check the exact location of sh so:&lt;BR /&gt;&lt;BR /&gt;$ which sh&lt;BR /&gt;&lt;BR /&gt;hth&lt;BR /&gt;Claudio</description>
      <pubDate>Mon, 14 Jul 2003 12:57:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022868#M5648</guid>
      <dc:creator>Claudio Cilloni</dc:creator>
      <dc:date>2003-07-14T12:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022869#M5649</link>
      <description>#!/bin/bash&lt;BR /&gt;mark=1&lt;BR /&gt;while [ $mark = 1 ]&lt;BR /&gt;do&lt;BR /&gt;df | grep -v Filesystem | while read line&lt;BR /&gt;do&lt;BR /&gt;MTP=$(echo "$line" | awk '{print $6}')&lt;BR /&gt;USE=$(echo "$line" | awk '{print $5}' | sed 's/.$//g')&lt;BR /&gt;if [ "$USE" -gt  "30" ]&lt;BR /&gt;then&lt;BR /&gt;echo "$MTP $USE " &lt;BR /&gt;#echo "$MTP $USE " | mail -s "FS alert" harriskd@mcsc.usmc.mil&lt;BR /&gt;#sleep 100 #or whatever time&lt;BR /&gt;#else&lt;BR /&gt;#sleep 100 #or whatever time&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;sleep 100&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this script works.&lt;BR /&gt;&lt;BR /&gt;1. use -gt for numeric comparisons. &amp;gt; for string comparisons.&lt;BR /&gt;&lt;BR /&gt;2. dont put the sleep in if /else loops. for every line of ur df outptut the script will sleep. instead have it in the outer loop.&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-balaji</description>
      <pubDate>Mon, 14 Jul 2003 13:01:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022869#M5649</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-14T13:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022870#M5650</link>
      <description>mmmmh...&lt;BR /&gt;&lt;BR /&gt;try this:&lt;BR /&gt;----------------------------------------------&lt;BR /&gt;#! /bin/sh&lt;BR /&gt;&lt;BR /&gt;df | grep -v Filesystem |&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;MTP=$(echo "$line" | awk '{print $6}')&lt;BR /&gt;USE=$(echo "$line" | awk '{print $5}' | sed 's/.$//g')&lt;BR /&gt;if [ "$USE" -gt "60" ]&lt;BR /&gt;then&lt;BR /&gt;  echo "$MTP $USE "&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;If you wanna run it hourly in cron, you shouldn't use the external endless while loop, because that loop prevents the script to go to an end, so cron will start a new endless script every hour.&lt;BR /&gt;&lt;BR /&gt;the "$USE" &amp;gt; "60" seems don't work, use -gt.&lt;BR /&gt;&lt;BR /&gt;remember to complete the 'echo' line with the 'mail' command piped (I removed it just to test the script without sending mail).&lt;BR /&gt;&lt;BR /&gt;Ciao&lt;BR /&gt;Claudio&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Jul 2003 13:06:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022870#M5650</guid>
      <dc:creator>Claudio Cilloni</dc:creator>
      <dc:date>2003-07-14T13:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022871#M5651</link>
      <description>In your previous post I went through and posted that i found the problem in my script... I then at the bottom posted the corrections to my script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;mark=1&lt;BR /&gt;while [ $mark = 1 ]&lt;BR /&gt;do&lt;BR /&gt;df | grep -v Filesystem |&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;MTP=$(echo "$line" | awk '{print $6}')&lt;BR /&gt;USE=$(echo "$line" | awk '{print $5}' | sed 's/.$//g')&lt;BR /&gt;if [ "$USE" &amp;gt; "60" ]&lt;BR /&gt;then&lt;BR /&gt;echo "$MTP $USE " | mailx -s "FS alert" sendto@work.com&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;else&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;done</description>
      <pubDate>Mon, 14 Jul 2003 13:19:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022871#M5651</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-14T13:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022872#M5652</link>
      <description>sorry... didn't read your entire post before i posted my last post...</description>
      <pubDate>Mon, 14 Jul 2003 13:21:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022872#M5652</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-14T13:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022873#M5653</link>
      <description>ok... ugh... sorry for all these posts... I'm extreemly upset today becuase I'm buying a new car and the dealership is giving me the run around.... AHHHHHHHHHH&lt;BR /&gt;&lt;BR /&gt;sorry...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;anyway ... i would use the BASH shell not sh.  That's what I originally scripted this in.  (I put ksh in one of the last posts becuase I'm losing it today... i need a vacation)  try not putting any shell interpreter in the first line or if you do try using &lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;&lt;BR /&gt;Also ... do you get any error messeges in your code.. also putting this in cron might not be the best way to launch it.... i would put it in your startup scripts when the system starts.  Then you don't need to worry about cron&lt;BR /&gt;&lt;BR /&gt;once again.. sorry for all the posts... it's just been a really rough couple of days for me</description>
      <pubDate>Mon, 14 Jul 2003 13:27:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022873#M5653</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-14T13:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022874#M5654</link>
      <description>John, No problem about the messages. Good luck with the car. &lt;BR /&gt;&lt;BR /&gt;To all, i'll try suggestions from your posts in a minute. I wasn't getting any errors, it just wasn't running. I believe one of you said the way i had the script it would create an endless script every hour, which i believe it was when i looked at my processes! I'll respond back in a few. Thanks!</description>
      <pubDate>Mon, 14 Jul 2003 13:46:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022874#M5654</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-14T13:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022875#M5655</link>
      <description>Kyle - yes... this script, as is, if entered into a cron job would start an endless script every time you ran it....&lt;BR /&gt;&lt;BR /&gt;to change that either 1 of 2 things can be done.&lt;BR /&gt;&lt;BR /&gt;1 - enter it into your start up scripts on your box&lt;BR /&gt;2 - remove the folloing lines:&lt;BR /&gt;mark=1&lt;BR /&gt;while [ $mark = 1 ]&lt;BR /&gt;do &lt;BR /&gt;#and also&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;else&lt;BR /&gt;sleep 100 #or whatever time &lt;BR /&gt;#and also&lt;BR /&gt;done #which is the last line which closes the while [$mark = 1 ] line</description>
      <pubDate>Mon, 14 Jul 2003 13:55:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022875#M5655</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-14T13:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022876#M5656</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;You can start the script as he if you will&lt;BR /&gt;start it in the boot by adding link to him&lt;BR /&gt;to the runlevel that you work in.&lt;BR /&gt;&lt;BR /&gt;ln -s &amp;lt;script path&amp;gt; /sbin/rcX.d/S998diskcheck&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Mon, 14 Jul 2003 18:49:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022876#M5656</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-07-14T18:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: FileSystemAlert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022877#M5657</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;You can start the script as he if you will&lt;BR /&gt;start it in the boot by adding link to him&lt;BR /&gt;to the runlevel that you work in.&lt;BR /&gt;&lt;BR /&gt;ln -s &amp;lt;script path&amp;gt; &lt;BR /&gt;/etc/rc.d/rcX.d/S998diskcheck&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Mon, 14 Jul 2003 18:50:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filesystemalert-script/m-p/3022877#M5657</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-07-14T18:50:43Z</dc:date>
    </item>
  </channel>
</rss>

