Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-09-2010, 12:30 AM   #1
LQ Newbie
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
Disk Space Monitoring

I'm very new to Linux and scripting; been using Fedora 13 for about a month now and playing around with scripting for just about two weeks. But my problem is that I don't like to just install things without understanding them. I understand what the script does but not what the commands within the script tell it to do.

For the most part I haven't a clue about scripting and want to learn. I found this script online and I've been able to find a few of the commands online that explain a bit about what is going on in the script but for the most part I haven't the foggiest as to how the script works.

I'm hoping someone can help me understand what is actually happening in this script. I know that I can set the computer to warn me when my disk space is getting low but lets face it, where is the fun in that.

# comment
df -H | grep -vE '^none' | awk ' { print $5 " " $1 }' | while read output;
#echo $output
usep=$(echo $output | awk ' { print $1 }' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $ALERT ]; then
echo "Running out of space \"$partition ($usep%)\" on$(hostname) as on $(date)"|
mail -s "Alert: Almost out of disk space $usep" $ADMIN
Old 08-09-2010, 02:23 AM   #2
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
I understand what the script does but not what the commands within the script tell it to do.
Simplest way is run command on shell which are defined in script.

BTW there are some variables and logic is used.

Last edited by sem007; 08-09-2010 at 02:24 AM.
Old 08-09-2010, 03:39 AM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,670

Rep: Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487
Good docs that cover shell programming:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitoring disk space scottyp55 Red Hat 5 03-22-2010 10:32 AM
script for disk space monitoring jmmo1981 Red Hat 1 05-24-2008 11:25 AM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 03:58 PM
Monitoring disk space on webserver!!! apache Linux - Software 2 07-27-2004 07:47 AM
monitoring disk space cuss Linux - General 26 02-25-2003 12:44 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration