Background Diskspace Monitor

Stuff that has yet to be sorted into a category.
Post Reply
Message
Author
brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

Background Diskspace Monitor

#1 Post by brad_chuck »

The below script will warn you if your disk space gets below the "limit" (in MB).

I use this because I don't like the free disk space on the task bar. I have Puppy installed on a 100G drive....

Works great for me and I thought I would share.

Use the pet or use the tar.gz and untar it in your /root/Startup folder to run at each startup.

Code: Select all

#!/bin/sh
#       dfwarn - Low Disk Space Warning v0.0.2
#       Copyright 2008 Brad Coulthard, email in below file (trying to avoid spam)
limit="100"                                     # Where we give a warning in MB's
quiet="0"                                       # If warned don't do it over and over..
while [ 1 ];do
	dfget=$(df -h | grep rootfs | cut -c 35-38) # Full text of freespace -> 110G
	mod=${dfget:(${#dfget}-1)}                  # The last part -> G
	nub=${dfget:0:(${#dfget}-1)}                # frist part -> 110
	if [ $dfget = "0" ]; then                   # If diskspace is 0
		Xdialog --msgbox "!!! OUT OF DISK SPACE !!!\nAddress this NOW or your system WILL crash!!" 10 60
	fi
	if [[ $nub -lt $limit && "$mod" = "M" && "$quiet" = "0" ]]; then  # If diskspace is below Limit (above)
		Xdialog --msgbox "There is ${nub}M free on your disk.\nFree up some space to avoid a crash!" 10 40
		quiet="1"
	fi
	sleep 10
done
Attachments
dfwarn-0.0.2.tar.gz
(643 Bytes) Downloaded 379 times
dfwarn-0.0.2.pet
(836 Bytes) Downloaded 346 times
Last edited by brad_chuck on Sun 30 Nov 2008, 23:37, edited 1 time in total.

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

#2 Post by brad_chuck »

I left a debugging line in the version of the file that I mad the dot pet out of.

The corrected files are above.

The old one (0.0.1) will not work so if you downloaded it please remove it and use the corrected ones above(0.0.2).

Post Reply