Espacio remanente en discos Openvms
Otros
1.050 visualizaciones desde el 13 de Enero del 2020
Es un programa que permite ver el espacio remanente en discos bajo el sistema operativo open vms
$!----------------------------------------------------------------------------+
$! DISK.COM - Muestra el espacio en todos los discos |
$!----------------------------------------------------------------------------+
$! Author: Edgar Ulloa Panama
$!
$!------------------------------------------------------------------------
$ YELLOW_ALERT_PERCENT = 75 ! Percent full for yellow alert
$ RED_ALERT_PERCENT = 85 ! Percent full for red alert
$!
$ SAVERIFY = 'F$VERIFY(0)' ! Turn off verification
$ IF P1 .EQS. "" THEN P1 = "*"
$!Unit Device Type Blks Free Blks Used Pcnt 0% 25% 50% 75% 100%
$!1234 1234567890123456 1234 123456789 123456789 123% |1234567890123456789012345|
$ ESC[0,8] = 27 ! ESCape; needed for flagging alerts
$ ENDATTR = ESC + "[0m" ! Turn off all attributes
$ RPTFAO = "!4ZL !AS!16AS !4AS !9UL !9UL !3UB%!AS |!AS|"
$ TMPFIL = "SYS$SCRATCH:DISK" + F$GETJPI("","PID") + ".TMP"
$ CLOSE/NOLOG TMPFIL
$ OPEN/WRITE TMPFIL 'TMPFIL'
$ LOOP:
$ DISKNAME = F$DEVICE("''P1'","DISK") - "_" ! Get a disk name
$ IF DISKNAME .EQS. "" THEN GOTO FINISHED ! Blank after last one
$!
$! Exclude drives with no or meaningless information
$ IF .NOT. F$GETDVI(DISKNAME,"MNT") THEN GOTO LOOP ! Only mounted disks
$ IF F$GETDVI(DISKNAME,"FOR") THEN GOTO LOOP ! Not mounted /FOREIGN
$ IF F$GETDVI(DISKNAME,"MEDIA_NAME") .EQS. "" THEN GOTO LOOP ! INFOSERVER
$ IF F$GETDVI(DISKNAME,"SHDW_MEMBER") THEN GOTO LOOP ! No shadow members
$! The following line is for striped disks; the stripe volume will show up
$ IF (F$GETDVI(DISKNAME,"DEVCHAR2") .AND. 8388608) .NE. 0 THEN GOTO LOOP
$!
$! Get information
$ UNIT = F$GETDVI(DISKNAME,"UNIT") ! Disk unit number
$ DEVTYPE = F$GETDVI(DISKNAME,"MEDIA_NAME") ! Device type
$ TOTALBLOCKS = F$GETDVI(DISKNAME,"MAXBLOCK") ! Capacity
$ FREEBLOCKS = F$GETDVI(DISKNAME,"FREEBLOCKS") ! Free blocks
$ USEDBLOCKS = TOTALBLOCKS - FREEBLOCKS ! Used blocks
$ PERCENTUSED = ((USEDBLOCKS*100) + (TOTALBLOCKS/2)) / TOTALBLOCKS
$!
$! Format the information
$ BEGATTR = ENDATTR
$ IF PERCENTUSED .GE. YELLOW_ALERT_PERCENT THEN BEGATTR = ESC + "[1m"
$ IF PERCENTUSED .GE. RED_ALERT_PERCENT THEN BEGATTR = ESC + "[1;7m"
$ BARPCNT = (PERCENTUSED + 1)/4
$ FILLER = 25 - BARPCNT
$ BAR = F$FAO("''ESC'(0!''BARPCNT'*a''ESC'(B!''FILLER'* ")
$ WRITE TMPFIL F$FAO(RPTFAO,UNIT,BEGATTR,DISKNAME,DEVTYPE,FREEBLOCKS,-
USEDBLOCKS,PERCENTUSED,ENDATTR,BAR)
$ GOTO LOOP
$ FINISHED: ! This routine shows the disks in unit number order
$ CLOSE/NOLOG TMPFIL
$! TYPE/PAGE NL:
$! WRITE SYS$OUTPUT F$TIME() + " Disk Usage Statistics"
$! WRITE SYS$OUTPUT ""
$! SORT/WORK=0 'TMPFIL' 'TMPFIL'
$ WRITE SYS$OUTPUT "Device Type Blks Free Blks Used " +-
"Pcnt 0% 25% 50% 75% 100%"
$ OPEN/READ TMPFIL 'TMPFIL'
$ count = 0
$ PRTLOOP:
$ READ/END=GOAWAY TMPFIL ALINE
$ count = count + 1
$ WRITE SYS$OUTPUT F$EXTRACT(5,255,ALINE)
$ GOTO PRTLOOP
$ GOAWAY:
$ CLOSE/NOLOG TMPFIL
$ DELETE/NOLOG/NOCONFIRM 'TMPFIL';*
$ EXIT 1 + 0*F$VERIFY(SAVERIFY)
No hay comentarios