#!/bin/sh
#############################################################################
## telnetsignon.sh - StofaNet signon script (telnet) 
##
## Copyright (C) 2002 Jess Thrysoee <jess@thrysoee.dk>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
#############################################################################

# UserName
USER="<username>"
# PassWord
PASS="<password>"
# SignOn server IP
IP="192.168.30.2"
# SignOn server port
PORT="259"

if [ -z "$1" ] || [ "$1" != 1 -a "$1" != 2 -a "$1" != 3 ]; then
   echo "Usage: `basename $0` 1|2|3"
   echo ""
   echo "   1 = signon"
   echo "   2 = signoff"
   echo "   3 = status"
   echo ""

   exit 1
fi

# Telnet closes the connection as soon as its standard input is exausted,
# therefore the delays are added. This is a poor mans 'Expect' script :-)
(  echo $USER; sleep 1
   echo $PASS; sleep 1
   echo $1   ; sleep 1  ) |telnet $IP $PORT

# EOF
