PROSHUT Menu

Rabbit

Member
In the proshut menu, can I hidden option 2 and 3 (Unconditional Shutdown and Emergency Shutdown)? It is because I have write a proshut script for the operator to kill the dead user, in order to avoid them to select option 2 or 3 accidentally, I am searching is there any method to hide the option, thank you!
 

dba

New Member
Maybe use whats behind door number 2

Well I have encountered the problem that you have many times. One of the best solutions is to remove the 'manual' part out of the picture. Dan Foreman wrote some sample code on how to do this many years ago. I still have a (modified) snippet, maybe it will help. A side benefit of the following code is that it alphabetizes(spelling?) the users to make it easier to find the one you want to kill.


/*
kilzmded.p
log off users in a friendly way.
*/

DEF INPUT PARAMETER ipDbname AS CHARACTER NO-UNDO.
DEF INPUT PARAMETER ipPathname AS CHARACTER NO-UNDO.
DEF VAR db AS CHAR FORMAT "x(52)" LABEL 'DB Name' NO-UNDO.
DEF VAR tmp AS CHAR EXTENT 9 NO-UNDO.
DEF VAR dtmp AS CHAR EXTENT 8 NO-UNDO.
DEF VAR i AS INT NO-UNDO.
DEF VAR lgFalse AS LOGICAL INITIAL FALSE NO-UNDO.

DEF TEMP-TABLE usr
FIELD User# AS char
FIELD usrid AS CHAR LABEL 'Userid'
FIELD Login AS CHAR LABEL 'Login Time' FORMAT 'x(20)'
FIELD pid AS CHAR FORMAT 'x(5)'
FIELD tty AS CHAR FORMAT 'x(12)'
INDEX usr# user#.
DEF BUTTON Exit size 10 by 1
LABEL "&Exit".
DEF QUERY q FOR usr.

DEF BROWSE bUsers QUERY q
DISPLAY usr
WITH 5 DOWN MULTIPLE WIDTH 80.

DEF FRAME f bUsers Exit WITH NO-BOX.
enable all with frame f.
/*
ON CHOOSE OF Exit
DO:
APPLY "CLOSE" TO THIS-PROCEDURE.

END.
*/

db = ipPathname + ipDbname.

/* USER LIST UPDATE */
OS-COMMAND SILENT proshut VALUE(db) -C list > VALUE ('/tmp/' + ipDbname + '.usr').
INPUT FROM VALUE('/tmp/' + ipDbname + '.usr').
IMPORT ^. /* WHAT IF NO USERS AT ALL; TEST FOR ZERO BYTE FILE */
REPEAT:
IMPORT tmp.
CREATE usr.
ASSIGN
user# =tmp[1]
pid =tmp[2]
login =tmp[3] + " " + tmp [4] + " " +
tmp[5] + " " + tmp [6] + " " + tmp[7]
usrid =tmp[8]
tty =tmp[9].
END.

OPEN QUERY q FOR EACH usr by usrid.
UPDATE bUsers WITH FRAME f.

DO i = 1 to bUsers:NUM-SELECTED-ROWS :
IF bUsers:FETCH-SELECTED-ROW(i)
THEN DO:
OS-COMMAND SILENT proshut VALUE(db) -C DISCONNECT VALUE(user#) > bye.tmp.
INPUT FROM bye.tmp.
IMPORT UNFORMATTED tmp[1].
DISPLAY usrid pid tty.
INPUT CLOSE.
NEXT.
END.
END.
wait-for end-error of frame f or choose of Exit.
 
Top