PROGRAM CHKFRE This program checks disks for free space, and executes a command file when the disk space falls below a user specified level. The disks to be checked and the minimum free space desired are read from the file: LB:[1,2]CHKFRE.CMD (This file also contains the commands that are to be executed when the free space on a disk falls below the minimum). CHKFRE.CMD contains one line of the following form for each disk to be checked: .;* DDn: nnnnn DDn: is the disk to be checked and nnnnn is the minimum free space for that disk. The list of disks is terminated by the following line: .;- If the free space on any of the disks checked falls below the given level then CHKFRE.CMD is executed (from terminal TT0:) by a specially installed version (CHKFR2) of the indirect command processor, once for each disk that is low on disk space. (Note that the data lines in CHKFRE.CMD begin with ".;", and are therefore comments to the indirect command processor). CHKFRE.CMD is executed with the following parameters: P1 = The name of the disk that is low on disk space (DDn:) P2 = The actual amount of free space on that disk. If the disk was not accessible, then P1 = "*". Example CHKFRE.CMD file: .;* DR0: 05000 .;* DR1: 10000 .;- .ENABLE SUBSTITUTION,QUIET .DISABLE DISPLAY .IF P2 = "*" .EXIT BRO ALL:"Warning: 'P1' has only 'P2' blocks free." To run CHKFRE, insert the following in LB:[1,2]STARTUP.CMD : INS CHKFRE INS $ICP/TASK=CHKFR2 RUN CHKFRE H/RSI=1H (This runs CHKFRE every hour, on the hour) BYTE DISK(10), COMMND(26), FLAGS(4), DOT, SEMI, STAR, DASH, BLANK INTEGER MINFRE, RESULT, STATUS(8), DSW, ERR REAL IND LOGICAL ATCOM, OK, DONE DATA DISK / 4*0, '[', '0', ',', '0', ']', 0 / DATA DOT, SEMI, STAR, DASH, BLANK + / 1H., 1H;, 1H*, 1H-, 1H / DATA COMMND / + 1H@, 1HL, 1HB, 1H:, 1H[, 1H1, 1H,, 1H2, 1H], + 1HC, 1HH, 1HK, 1HF, 1HR, 1HE, 11*1H / DATA IND /6RCHKFR2/ CALL ASSIGN(1, 'LB:[1,2]CHKFRE.CMD') CALL FDBSET(1, 'READONLY') CALL ERRSET(43, .TRUE., .FALSE., .FALSE., .FALSE.) 5036 CONTINUE READ(1, 100, END=999) FLAGS, (DISK(I), I = 1, 4), MINFRE 100 FORMAT(4A1, 4A1, I6) ATCOM = (FLAGS(1) .EQ. DOT) .AND. (FLAGS(2) .EQ. SEMI) OK = ATCOM .AND. (FLAGS(3) .EQ. STAR) DONE = ATCOM .AND. (FLAGS(3) .EQ. DASH) IF (.NOT.(OK)) GO TO 6152 CALL ASSIGN(2, DISK) CALL ERRTST(43, ERR) IF (.NOT.(ERR .EQ. 1)) GO TO 6154 RESULT = -1 GO TO 6155 6154 CONTINUE CALL FRESPC(2, MINFRE, RESULT) 6155 CONTINUE IF (.NOT.(RESULT .NE. 0)) GO TO 6156 COMMND(17) = DISK(1) COMMND(18) = DISK(2) COMMND(19) = DISK(3) COMMND(20) = DISK(4) IF (.NOT.(RESULT .LT. 0)) GO TO 6158 COMMND(22) = STAR DO 9166 I = 23, 26 COMMND(I) = BLANK 9166 CONTINUE GO TO 6159 6158 CONTINUE CALL NCODEI(RESULT, COMMND(22), 5) 6159 CONTINUE CALL SPAWN(IND, 1, 1, 15,, STATUS,, COMMND, 26, + 0, 'TT', DSW) IF (.NOT.(DSW .LE. 0)) GO TO 6160 CALL CLOSE(1) CALL ASSIGN(3, 'CO:') WRITE(3, 300) COMMND, DSW 300 FORMAT(' CHKFRE -- Spawn failure: "', 26A1, '"', + 5X, 'DSW =', I6) GO TO 6161 6160 CONTINUE CALL WAITFR(15) 6161 CONTINUE 6156 CONTINUE 6152 CONTINUE IF (.NOT.(DONE)) GO TO 5036 999 CALL EXIT END SUBROUTINE NCODEI(NUMBER, STRING, LEN) --- ENCODE A POSITIVE INTEGER NUMBER (*NUMBER*) LEFT JUSTIFIED, INTO A - CHARACTER STRING (*STRING*) OF LENGTH (*LEN*). INTEGER NUMBER, LEN INTEGER NUM, DIGIT BYTE STR(5), STRING(LEN), DIGITS(10), BLANK DATA BLANK /1H / DATA DIGITS(1) /1H0/, DIGITS(2) /1H1/, DIGITS(3) /1H2/, + DIGITS(4) /1H3/, DIGITS(5) /1H4/, DIGITS(6) /1H5/, + DIGITS(7) /1H6/, DIGITS(8) /1H7/, DIGITS(9) /1H8/, + DIGITS(10) /1H9/ NUM = NUMBER I1 = LEN + 1 5036 CONTINUE I1 = I1 - 1 NEWNUM = NUM / 10 DIGIT = NUM - NEWNUM * 10 NUM = NEWNUM STR(I1) = DIGITS(DIGIT + 1) IF (.NOT.((NUM .EQ. 0) .OR. (I1 .EQ. 0))) GO TO 5036 I2 = 1 DO 9166 I = I1, LEN STRING(I2) = STR(I) I2 = I2 + 1 9166 CONTINUE RETURN END