#!/bin/bash

#used for cli command "set system services telnet connection-limit"
#input $1:Maximum number of allowed connections [0..250]
#no output

if [ $# -eq 1 ]
then
    if [ $1 -eq 0 ]
    then
        sed -i "s/instances.*/instances = UNLIMITED/" /etc/xinetd.conf
    else
	sed -i "s/instances.*/instances = $1/" /etc/xinetd.conf
    fi
    /etc/init.d/xinetd reload > /dev/null
fi
exit 0

