I made a couple of changes on the status page of dsmod (status.cgi)
1) I changed the status bar style to be similar to the one used in ipcop, code:
2) I added the usb storage usage percentage view on front page, currently i have only 1 usb attached, so i don't know how will the code manage with more than 1.
code:
1) I changed the status bar style to be similar to the one used in ipcop, code:
Code:
stat_bar() {
percent=$1; let bar="percent*4"; let grey="(100-percent)*4"
#echo '<p><img src="/images/green.png" width="'"$bar"'" height="10" border="0" alt=""><img src="/images/grey.png" width="'"$grey"'" height="10" border="0" alt=""> '$percent' %</p>'
cat << EOF
<table><tr><td>
<table width='400' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:#a0a0a0;width:400px;height:10px;'>
<tr>
<td width='$bar' bgcolor='#a0a0a0' style='background-color:#a0a0a0;border-style:solid;border-width:1px;border-color:#e2e2e2'></td>
<td width='$grey' bgcolor='#e2e2e2' style='background-color:#e2e2e2;border-style:solid;border-width:1px;border-color:#e2e2e2'><img src='/images/null.gif' width='1' height='1' alt='' /></td>
</tr>
</table>
</td>
<td>
$percent %</td>
</tr>
</table>
EOF
}
2) I added the usb storage usage percentage view on front page, currently i have only 1 usb attached, so i don't know how will the code manage with more than 1.
code:
Code:
has_usb() {
if mount | grep " on /var/media/ftp/" > /dev/null ; then
return 1
fi
return 0
}
Code:
has_usb
if [ "$?" == "1" ]; then
sec_begin 'USB Storage'
total="$(df | grep "/media/ftp/" | awk '{print $2}')"
used="$(df | grep "/media/ftp/" | awk '{print $3}')"
let percent="100*used/total"
echo "<p>$used of $total KB used</p>"
stat_bar $percent
sec_end
fi