#!/bin/sh

# Check if the connection to ERP5 server is possible.

echo -n '.' > 2

if wget http://192.168.254.20/erp5/login_form -O - > /dev/null ; then
  echo 'unable to connect to ERP5 website'
  exit 1
fi

echo -n '.' > 2

telnet 192.168.254.20 22 > /tmp/umitest.telnet.out &
sleep 10
kill $!

echo -n '.' > 2

if [ `grep -q /tmp/umitest.telnet.out Connected` != "Connected to 192.168.254.20." ] ; then
  echo 'connection to ssh server on erp5 failed'
  rm -f /tmp/umitest.telnet.out
  exit 1
fi

rm -f /tmp/umitest.telnet.out