HP3000-L Archives

April 2001, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Melvin R Rees <[log in to unmask]>
Reply To:
Melvin R Rees <[log in to unmask]>
Date:
Tue, 17 Apr 2001 04:16:30 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (182 lines)
We have a script that we uses MPE to check the activity with a
SHOWPROC command every few minutes.  It is run from a job stream.  The
overhead mught be too much for some people, but the flexibility is
good.  This is also a good example of how we read files from the first
record to the last without using a MSG file.

Here are the files we use:

EMSIDLE - Main process loop calls
  EMSRECTL to check a file of SHOWPROC for changes to the CPU seconds
        and to check a file of exceptions
  EMSRECCK to issue abortjobs
     EMSRECFD to scan a file of showjobs to determine who to abort

EMSIDLEF - file with list of user to NOT abort.

It stores most of it's variables as MPE VAR's

EMSIDLE
1) loop forever
2) SHOWPROC to a file
3) use EMSRECTL to get total CPU time from SHOWPROC file
4) use EMSRECCK to check the time against last run
    if needed abort the session
5) pause until next time

PARM INTERVAL=300,MAXTIME=2700,LIMIT=30
DELETEVAR EMSJB@
SETVAR EMSDONE 0
WHILE EMSDONE = 0
  SHOWPROC JOB=@S >EMSIDLEF
  EMSRECTL :,8 <EMSIDLEF
  SHOWVAR EMSJB@_NEW >EMSIDLEF
  SHOWJOB JOB=@S
  EMSRECCK !INTERVAL,!MAXTIME,!LIMIT <EMSIDLEF
  ECHO PAUSE !INTERVAL
  PAUSE !INTERVAL
ENDWHILE

EMSRECTL - read SHOWPROC from $STDIN
1) set EMSSESS to Session ID
2) set EMSSESS_NEW to 0 or sum of CPU seconds from file.

PARM VAL,COL
SETVAR EMSRECCNT 0
SETVAR CIERROR 0
CONTINUE
INPUT EMSREC  >$NULL
WHILE CIERROR=0 DO
  IF (LEN(EMSREC) > !COL+LEN("!VAL")) THEN
  IF ("!VAL"=STR ('!EMSREC',!COL,LEN("!VAL"))) THEN
    SETVAR EMSRECCNT EMSRECCNT+1
    SETVAR EMSSESS RTRIM("EMSJB_![STR (EMSREC,24,6)]")
    IF NOT BOUND (![EMSSESS]_OLD) THEN
      SETVAR ![EMSSESS]_OLD 0
      SETVAR ![EMSSESS]_TIME 0
    ENDIF
    IF NOT BOUND (![EMSSESS]_NEW) THEN
      SETVAR ![EMSSESS]_NEW 0
    ENDIF
    SETVAR ![EMSSESS]_NEW ![EMSSESS]_NEW + &
           ![STR(EMSREC,9,2)]![STR(EMSREC,12,3)]
  ENDIF
  ENDIF
  SETVAR EMSREC "  "
  CONTINUE
  INPUT EMSREC  >$NULL
ENDWHILE
DELETEVAR EMSREC

EMSRECCK - Checks data to see if we can abort a session.
1) Check to see if more than LIMIT user are on.
2) Set EMSSESS to Session ID
3) if EMSSESS_NEW <> EMSSESS_OLD session is not idle : reset
    set EMSSESS_OLD to EMSSESS_NEW; set EMSSESS_TIME to 0
4) else total time session is idle into EMSSESS_TIME
5) if EMSSESS_TIME > MAXTIME then check if user is in EMSIDLEF
6) if USER is in the file SKIP and display message
7) if USER is not in the file ABORTJOB

PARM INTERVAL=600,MAXTIME=2700,LIMIT=30
SETVAR CIERROR 0
SETVAR EMSALLOWABORT "N"
IF (HPUSERCOUNT <= !LIMIT) THEN
  SETVAR EMSALLOWABORT "Y"
ENDIF
CONTINUE
INPUT EMSREC  >$NULL
WHILE CIERROR=0 DO
    SETVAR EMSSESS "![STR (EMSREC,1,POS("=",EMSREC)-6)]"
    IF ![EMSSESS+"_NEW"] <> ![EMSSESS+"_OLD"] THEN
      SETVAR ![EMSSESS]_OLD ![EMSSESS]_NEW
      SETVAR ![EMSSESS]_TIME 0
    ELSE
      SETVAR ![EMSSESS]_TIME ![EMSSESS]_TIME + !INTERVAL
    ENDIF
    DELETEVAR ![EMSSESS]_NEW
    IF ![EMSSESS]_TIME > !MAXTIME THEN
      SHOWJOB ![STR (EMSSESS,POS("_",EMSSESS)+1,6)] >EMSTMP1
      EMSRECFD #,1,EMSNAME,46,30 <EMSTMP1
      EMSRECFD "!EMSNAME",1,EMSNAME,1,30 <EMSXLIST.CMT.SYS
      IF EMSNAME="NOTFOUND"
        ECHO ABORTJOB ![STR (EMSSESS,POS("_",EMSSESS)+1,6)]
        TELLOP Idle Job Aborted ![STR (EMSSESS,POS("_",EMSSESS)+1,6)]
        CONTINUE
        IF (EMSALLOWABORT="Y") THEN
          ABORTJOB  #![STR (EMSSESS,POS("_",EMSSESS)+1,6)]
        ENDIF
      ELSE
        ECHO NO ABORT FOR  ![STR (EMSSESS,POS("_",EMSSESS)+1,6)]
EMSNAME
      ENDIF
    ENDIF
  SETVAR EMSREC "  "
  SETJCW CIERROR = 0
  CONTINUE
  INPUT EMSREC  >$NULL
ENDWHILE
DELETEVAR EMSREC
DELETEVAR EMSNAME

EMSRECFD - Scan a file for VAL in COL set CIVAR !VAR to data at COL1
for length of LEN.  Great for searching fixed datafiles or storing
data from MPE scripts

PARM VAL,COL,VAR,COL1,LEN
SETVAR CIERROR 0
CONTINUE
INPUT EMSREC  >$NULL
WHILE (CIERROR=0) AND ("!VAL"<>"![STR ("!EMSREC",!COL,LEN("!VAL"))]")
DO
  SETVAR EMSREC "  "
  CONTINUE
  INPUT EMSREC  >$NULL
ENDWHILE
IF (CIERROR=0) THEN
  SETVAR !VAR "![STR ("!EMSREC",!COL1,!LEN)]"
ELSE
  SETVAR !VAR "NOTFOUND"
ENDIF
DELETEVAR EMSREC

To run simply put these files in PUB.SYS and then stream a Job like
this:

!JOB IDLE,MANAGER.SYS
!EMSIDLE
!EOJ

You can change the intervals with parameters.

Rgds
Mel Rees
[log in to unmask]

On Mon, 16 Apr 2001 20:15:11 -0500 (Central Daylight Time), Stan
Sieler <[log in to unmask]> wrote:

>Re:
>> Is there a way to cause a specific user to automatically logoff the HP 3000
>> after a specified amount of time in which they are inactive?  For example,
>
>Jeff writes:
>
>> You might look into BOUNCER or the Allegro equivalent for something that
>> watches for any timeout on pending reads.
>
>Our free solution is BOUNCE, from http://www.allegro.com/software/hp3000/allegro.html
>
>Our product solution is KNOCKOUT, from Lund Performance Solutions
>http://www.lund.com/Products/SMTool/index.html
>
>Stan Sieler                                           [log in to unmask]
>www.allegro.com/sieler/wanted/index.html          www.allegro.com/sieler
>
>* To join/leave the list, search archives, change list settings, *
>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2