#!/bin/sh -e
#
# Test if the RDP server is operational

. /usr/share/debian-edu-config/testsuite-lib.sh

if test -r /etc/debian-edu/config ; then
    . /etc/debian-edu/config
fi

# Only Thin-Client-Server profiles provide RDP
if echo "$PROFILE" | egrep -q 'Thin-Client-Server' ; then
    :
else
    exit 0
fi

if pidof xrdp > /dev/null ; then
    echo "success: $0: xrdp is running."
else
    echo "error: $0: xrdp is not running."
fi

if pidof xrdp-sesman > /dev/null ; then
    echo "success: $0: xrdp-sesman is running."
else
    echo "error: $0: xrdp-sesman is not running."
fi

netstat_check 3389 tcp "xrdp" || true
netstat_check 3350 tcp "xrdp-sesman" || true
