#!/bin/sh


set -e


# do not use /usr/bin/davmail as most test environments do not include
# binfmt_misc support, see https://bugs.debian.org/901030
# but at least test some binary named davmail is executable.
test -x /usr/bin/davmail || echo "davmail binary not executable" >&2
java -jar /usr/share/davmail/davmail.jar /etc/davmail.properties &

pid=$!
sleep 10
nc -z localhost 1025 || echo "Daemon does not seem to listen" >&2
kill $pid
