add quota functionality
This commit is contained in:
23
action.sh
23
action.sh
@@ -36,7 +36,7 @@ PASS=$(cat "$3")
|
|||||||
|
|
||||||
## FUNCTIONS
|
## FUNCTIONS
|
||||||
function checkaction {
|
function checkaction {
|
||||||
REGEX="^adduser$|^changepw$|^listusers$|^userdetail$|^deluser$|^sizeall$|^sizeuser$|^viewdata$|^addalias$"
|
REGEX="^adduser$|^changepw$|^listusers$|^userdetail$|^deluser$|^sizeall$|^sizeuser$|^viewdata$|^addalias$|^quota$"
|
||||||
if [[ $1 =~ $REGEX ]]; then
|
if [[ $1 =~ $REGEX ]]; then
|
||||||
echo "true"
|
echo "true"
|
||||||
else
|
else
|
||||||
@@ -332,6 +332,27 @@ if [ "$ACTION" == "userdetail" ]; then
|
|||||||
|
|
||||||
fi # /userdetail
|
fi # /userdetail
|
||||||
|
|
||||||
|
# # # # #
|
||||||
|
# QUOTA
|
||||||
|
# # # # #
|
||||||
|
if [ "$ACTION" == "quota" ]; then
|
||||||
|
echo "Calculating account disk usage..."
|
||||||
|
echo
|
||||||
|
|
||||||
|
USAGE=$(quota -gsl | tail -n 1 | awk -F" " '{ print $2 }' | sed 's/[A-Za-z]//g')
|
||||||
|
QUOTA=$(quota -gsl | tail -n 1 | awk -F" " '{ print $3 }' | sed 's/[A-Za-z]//g')
|
||||||
|
|
||||||
|
PERC=$(echo "scale=2; $USAGE/$QUOTA" | bc)
|
||||||
|
PERC=$(echo "scale=2; $PERC*100" | bc)
|
||||||
|
|
||||||
|
echo "$USAGE MB of $QUOTA MB are used ($PERC %)."
|
||||||
|
|
||||||
|
PERC=$(echo "scale=2; 100 - $PERC" | bc)
|
||||||
|
|
||||||
|
echo "You have "$[$QUOTA - $USAGE]" MB free ($PERC %)."
|
||||||
|
|
||||||
|
fi # /quota
|
||||||
|
|
||||||
# # # # #
|
# # # # #
|
||||||
# DELETE USER
|
# DELETE USER
|
||||||
# # # # #
|
# # # # #
|
||||||
|
|||||||
20
index.php
20
index.php
@@ -14,6 +14,10 @@
|
|||||||
<h4>You have following options:</h4>
|
<h4>You have following options:</h4>
|
||||||
|
|
||||||
<div id="gallery">
|
<div id="gallery">
|
||||||
|
<!--
|
||||||
|
GENERAL SECTION
|
||||||
|
-->
|
||||||
|
|
||||||
<p><strong>General</strong></p>
|
<p><strong>General</strong></p>
|
||||||
<!-- VIEWDATA - View datasheet of whole account -->
|
<!-- VIEWDATA - View datasheet of whole account -->
|
||||||
<b class="switch"><span class="turn_on">»</span><span class="turn_off">«</span> View the data sheet</b>
|
<b class="switch"><span class="turn_on">»</span><span class="turn_off">«</span> View the data sheet</b>
|
||||||
@@ -26,6 +30,22 @@
|
|||||||
</form>
|
</form>
|
||||||
</div> <!-- /hide -->
|
</div> <!-- /hide -->
|
||||||
|
|
||||||
|
<!-- QUOTA - Show free and used disk space an whole account -->
|
||||||
|
<b class="switch"><span class="turn_on">»</span><span class="turn_off">«</span> Show used disk space</b>
|
||||||
|
<div class="hide">
|
||||||
|
<p>Shows used and free disk space on your webhost. This sums up all
|
||||||
|
used space by emails, websites and databases.</p>
|
||||||
|
<form action="submit.php" method="post">
|
||||||
|
<button type="submit" name="action" value="quota">Show usage</button>
|
||||||
|
<!-- Hidden confirmation box -->
|
||||||
|
<input type="hidden" name="sure" value="yes" />
|
||||||
|
</form>
|
||||||
|
</div> <!-- /hide -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
EMAIL SECTION
|
||||||
|
-->
|
||||||
|
|
||||||
<p><strong>Email accounts</strong></p>
|
<p><strong>Email accounts</strong></p>
|
||||||
<!-- ADDUSER - Add a new email account -->
|
<!-- ADDUSER - Add a new email account -->
|
||||||
<b class="switch"><span class="turn_on">»</span><span class="turn_off">«</span> Add a new email</b>
|
<b class="switch"><span class="turn_on">»</span><span class="turn_off">«</span> Add a new email</b>
|
||||||
|
|||||||
Reference in New Issue
Block a user