#!/bin/sh -e
#
# Test if the webmin server is working.

retval=0

if grep -q "^allow=$" /etc/webmin/miniserv.conf ; then
    echo "success: Correct allow line in /etc/webmin/miniserv.conf."
else
    echo "error: Incorrect allow line in /etc/webmin/miniserv.conf."
    retval=1
fi

port=10000
proto=tcp

if netstat -a 2>&1 | grep ":$port " | grep -q "^$proto" ; then
    echo "success: $0: webmin server is listening on $port/$proto."
else
    echo "error: $0: webmin server is not listening on $port/$proto."
    retval=1
fi

exit $retval
