-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Before I put up the second part of the networking info script, heres a simple script that will display the freespace / usage of individual partitions on your hard drive. The main thing with this script is you have to manually edit in your partitions after the "grep" statement in the variable. Otherwise, you may get blank results.
// Start of Script
#!/bin/sh
#
# Script by Jason Gotti ([email removed for spambots)
# Written and tested on Ubuntu 7.04.
#
# Developed for use with conky, but also can be used
# for other information related purposes.
#
# If you don't have a seperate /home partiton, then just comment out
# all the variable lines having to do with a home partition, and all
# the echo lines having to do with /home.
#
# To add partitions to this script, simply follow the same format.
# To determine what to place after the grep command in the script,
# run "df -h" on a terminal, and use whatever is listed under "mounted on"
# for the desired partition.
# Home variables. (Comment out if you don't have a home partition.)
homesize=$(df -h | grep /home | awk {' print $2 '})
homeused=$(df -h | grep /home | awk {' print $3 '})
homefree=$(df -h | grep /home | awk {' print $4 '})
homeuseperc=$(df -h | grep /home | awk {' print $5 '} | awk -F% {' print $1 '})
homeperc=$(calc 100-$homeuseperc | awk {' print $1 '})
# Root variables.
rootsize=$(df -h | grep -w / | awk {' print $2 '})
rootused=$(df -h | grep -w / | awk {' print $3 '})
rootfree=$(df -h | grep -w / | awk {' print $4 '})
rootuseperc=$(df -h | grep -w / | awk {' print $5 '} | awk -F% {' print $1 '})
rootperc=$(calc 100-$rootuseperc | awk {' print $1 '})
# Root output.
echo "/ (root)"
echo " Size:" $rootsize
echo " Used:" $rootused
echo " Free:" "$rootfree ($rootperc%)"
# Home output. (Comment out if you don't have a home partition.)
echo /home
echo " Size:" $homesize
echo " Used:" $homeused
echo " Free:" "$homefree ($homeperc%)"
// End of Script
Again, be sure to edit in your partitions. As stated in the script, use "df -h" to help determine which partitions to use.
The script is called in .conkyrc like so:
${color #ffcb48}Disk Usage Info:
${color #FFFFFF}${execi 5 diskfreeinfo}
And it will output like this:
Disk Usage Info:
/ (root)
Size: 14G
Used: 3.0G
Free: 11G (77%)
/home
Size: 44G
Used: 1.8G
Free: 40G (95%)
Next is the second part in the networking info; Hosts Online.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHq/HLTiCACtcRvugRApaRAJ0X07i2gY2r+mZ4bHA/Wuv0B1WLhQCfd5Zj
k2AwXN5+4T+/gwS7yBIZjZ4=
=qs0p
-----END PGP SIGNATURE-----
No comments:
Post a Comment