I liked Jeff's host based suggestion and decided to build upon it.
The command file that follows allows a site, in addition to a default
limit, to also enforce different limits based MPE account, account and
user, or account user and jobname.
Here is a sample execution:
<SYS>:lmtlogon
You have too many sessions logged on as: XTIDIS,MANAGER.SYS
CPU=2. Connect=16. THU, APR 5, 2001, 6:56 PM.
<TELNET has been disconnected>
I hope someone will find it useful.
Regards
Paul Christidis
<<----------------------------------- Start Cut *+1
# Author: Paul Christidis e-mail: [log in to unmask]
# Date: 04/05/2001
#
# This command file is an enhancement to the one posted by
# Jeff Vance. It allows a site to 'configure' the number of
# sessions allowed to logon at the account, account_user or
# account_user_jobname level. It also allows the 'limit' to
# be applied to sessions orignating on the same IP address.
#
# Joblimit is a file that contains 'limit settings' for different
# MPE accounts, MPE users or Session names it should be of the
# format (Using the SYS account as an example):
# SETVAR SYS_limit 1
# SETVAR SYS_MANAGER_limit 2
# SETVAR SYS_MANAGER_XTIDIS_limit 3
#
# NOTE: The suffix of '_limit' is required
#
setvar _LG_DEFAULT_LIMIT 2
setvar _lg_limits_file "joblimit.pub.sys"
setvar _lg_limit_by_ip false
setvar _lg_this_limit _lg_default_limit
#
# Determine if a 'special' limit is configured for this user
#
if FINFO(_lg_limits_file,"exists") then
purge $oldpass > $null
fcopy from=!_lg_limits_file &
;to=$newpass;new;subset="!["!hpaccount"+"_"]",8 > $null
if FINFO("$OLDPASS", "exists") then
xeq $oldpass
endif
if BOUND(![hpaccount]_![hpuser]_![hpjobname]_limit) then
setvar _lg_this_limit ![hpaccount]_![hpuser]_![hpjobname]_limit
elseif BOUND(![hpaccount]_![hpuser]_limit) then
setvar _lg_this_limit ![hpaccount]_![hpuser]_limit
elseif BOUND(![hpaccount]_limit) then
setvar _lg_this_limit ![hpaccount]_limit
endif
endif
#
# Find all sessions logged on as "you"
#
setvar _lg_numjobs JOBCNT("@s:!hpjobname,!hpuser.!hpaccount",_lg_ses_list)
if _lg_numjobs > 1 then
# there is at least 1 other session logged on as "you"
if NOT _lg_limit_by_ip then
setvar _lg_ipcnt _lg_numjobs
else
setvar _lg_ipcnt 0
setvar _lg_i 0
while setvar(_lg_i,_lg_i+1) <= _lg_numjobs do
if JINFO(word(_lg_ses_list,,_lg_i),"ipaddr") = HPREMIPADDR then
setvar _lg_ipcnt _lg_ipcnt+1
endif
endwhile
endif
#
if _lg_ipcnt > _lg_this_limit then
echo ![chr(7)]
echo You have too many sessions logged on as: &
!hpjobname,!hpuser.!hpaccount
if _lg_limit_by_ip then
echo from the same IP address (!HPREMIPADDR).
endif
echo ![chr(7)]
bye
endif
endif
#
# Debug / Clean Up
#
if BOUND(traceon) then
showvar _lg_@, !hpaccount@_limit
else
deletevar _lg_@, !hpaccount@_limit
endif
------------------------------------------->> End cut *-1
* To join/leave the list, search archives, change list settings, etc *
* please visit http://raven.utc.edu/archives/hp3000-l.html *
|