webif/var/mongoose/include/diskspace.jim
hummypkg 884e17b3a7 add download option, require busybox 1.18.3-1
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@188 2a923420-c742-0410-a762-8d5b09965624
2011-06-21 22:38:20 +00:00

31 lines
728 B
Plaintext
Executable File

#!/mod/bin/jimsh
if {[os.gethostname] eq "hosting"} {
set size "1TB"
set used "100GB"
set perc "10"
} else {
foreach df [split [exec df -h 2>>/dev/null] "\n\r"] {
if [string match *sd*2* $df] {
regsub -all -- {[[:space:]]+} $df " " df
set fields [split $df]
set size [lindex $fields 1]
set used [lindex $fields 2]
set perc [string trimright [lindex $fields 4] "%"]
}
}
}
set file [format "%02d" [expr {$perc * 25 / 100 + 1}]]
puts "<div style=\"float: right; background:url('/images/345_1_27_ST_USB_BG.png')\">"
puts "<img src=/images/345_2_14_ST_HDD_$file.png>"
puts "</div>"
puts "<span style=\"float: right\">"
puts "<br>"
puts "Total space: $size<br>"
puts "Used: $used ($perc%)"
puts "</span>"