#!/mod/bin/jimsh if {[os.gethostname] eq "hosting"} { set size "1TB" set used "100GB" set perc "10" } else { set used 0 set size 0 set perc 0 foreach df [split [exec df -h 2>>/dev/null] "\n\r"] { if {[string match *sd?2* $df] || \ [string match *media/drive1* $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] "%"] break } } } set file [format "%02d" [expr {$perc * 25 / 100 + 1}]] # The HD model only has the USB images which are blue. I prefer the green # one so use those if available. if {[file exists /opt/share/images/blue/345_2_14_ST_HDD_01.png]} { set prefix 345_2_14_ST_HDD } else { set prefix 345_1_27_ST_USB } puts "
Total space: $size
Used: $used ($perc%)
"