home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / vms / 19511 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  7.5 KB

  1. Path: sparky!uunet!mcsun!ieunet!homer.mentec.ie!vulcan.mentec.ie!matt
  2. Newsgroups: comp.os.vms
  3. Subject: Re: Updated DISKFREE.COM (New Command File)
  4. Message-ID: <1992Dec17.170416.1@vulcan.mentec.ie>
  5. From: matt@vulcan.mentec.ie
  6. Date: 17 Dec 92 17:04:16 GMT
  7. Organization: Mentec Computer Systems, Dublin, Ireland
  8. Nntp-Posting-Host: vulcan
  9. Nntp-Posting-User: matt
  10. Lines: 256
  11.  
  12. Hello,
  13.  
  14. I have just recieved a copy of DISK_FREE the command file and wondered if anyone
  15. was interested in something similar we use on our site here.
  16.  
  17. It works on any VT100 upwards terminal and is pretty easy to use. The command
  18. file does not search for all disk devices so we use a logical defined to point
  19. to them all then call it as below.
  20.  
  21. $ sh log alldisks
  22.    "ALLDISKS" = "MAXUK$DUA0:" (LNM$PROCESS_TABLE)
  23.     = "MAXUK$DUA1:"
  24.     = "MAXUK$DUB0:"
  25.     = "MAXUK$DUB1:"
  26.     = "HALUK$DUA0:"
  27.     = "HALUK$DUA1:"
  28.     = "HALUK$DUB0:"
  29.     = "HALUK$DUB1:"
  30.     = "ORACUK$DKA300:"
  31.     = "ZENUK$DKA300:"
  32.     = "ZENUK$DKB300:"
  33.     = "ZENUK$DKB700:"
  34.  
  35. $ @men$command:im_disk_free alldisks 100000 25000
  36.  
  37. To get the full effect of the command file run it then wait sometime for the
  38. disk space to change before running it again !
  39.  
  40. I apologise in advance for the coding, it was knocked together in about 4 hours.
  41. BUT IT WORKS (or should :-) ).
  42.  
  43. I welcome any comments, suggestions etc.
  44.  
  45. Matt
  46.  
  47. --------------------------------------------------------------------------------
  48. Matthew Roxburgh : Mentec International (UK) Ltd, Mentec House, Birchwood Blvd,
  49.                    Birchwood, Warrington, Cheshire WA3 7QX. England.
  50. Voice / Fax      : +44 925 830000 / +44 925 830123    
  51. Internet         : matt@mentec.ie
  52. --------------------------------------------------------------------------------
  53. "The Surest Sign That Intelligent Life Exists Elsewhere In The Universe Is That
  54.  None Of It Has Tried To Contact Us"                 - Calvin (Calvin & Hobbes)
  55. --------------------------------------------------------------------------------
  56.  
  57.  
  58. $!-----------------------------CUT HERE-----------------------------------------
  59. $!   IM_DISK_FREE (c) 1992 Matthew Roxburgh - Mentec
  60. $!    - Another in the continuing IM series of command files
  61. $!
  62. $!   This command file gives the free space on a device in a bar graph format
  63. $!   multiple devices can be specified by using a logical pointing to all the 
  64. $!   devices required as P1 to this command file.
  65. $!
  66. $!   The volume free space on the first call of this command procedure is 
  67. $!   indicated by a thin line thus allowing changes to be spotted at a glance.
  68. $!
  69. $!   If the command file is called again with the same P1 parameter the change 
  70. $!   in disk space is indicated by a +/- in the blocks column.
  71. $!
  72. $!   The maximum scale of the graph can be specified by passing the number of 
  73. $!   blocks in p2 otherwise it is calculated to be the largest free space on 
  74. $!   the volumes specified.
  75. $!   
  76. $!   A danger threshold can be specified (again in blocks) as P3 if any disk 
  77. $!   falls below this level the bar is highlighted in bold. If the free blocks 
  78. $!   on any volume falls below 10% of this value then the situation is indicated
  79. $!   as a flashing bar.
  80. $!
  81. $!   P1 = device name or logical (logical can be a list of devices)
  82. $!        default = sys$sysdevice
  83. $!   P2 = max graph size
  84. $!        default = maximum free
  85. $!   P3 = danger threshhold (bars marked bold if below this)
  86. $!        N.B. bars flash if less than 10% of this figure
  87. $!        default = 10000   
  88. $
  89. $    set noverify
  90. $
  91. $    set term sys$output /nowrap
  92. $
  93. $    if "''loc$debug'" .EQS. "TRUE" THEN SET VERIFY
  94. $    if "''P1'" .eqs. "" then P1 = f$parse(f$environment("DEFAULT"),,,"DEVICE")
  95. $    if "''P1'" .eqs. "" then P1 = "sys$sysdevice:"
  96. $
  97. $    esc[0,8] = 27
  98. $    nor = esc + "#5"
  99. $    index = 0
  100. $
  101. $    max_free = 0
  102. $
  103. $ loop:
  104. $
  105. $    actdev = f$trnlnm(p1,, index)
  106. $    if actdev .eqs. ""
  107. $    then
  108. $        if index .eq. 0
  109. $        then
  110. $            actdev = P1
  111. $        else
  112. $            goto exit_loop
  113. $        endif
  114. $    endif
  115. $
  116. $    pad_dev = f$extract(0,15,"''f$getdvi(actdev,"DEVNAM")'                ")
  117. $    freb = F$GETDVI("''ACTDEV'","FREEBLOCKS")
  118. $
  119. $    if freb .gt. max_free then max_free = freb
  120. $
  121. $    index = index + 1
  122. $
  123. $    if "''old_df_para'" .eqs. P1
  124. $    then
  125. $        if dev_sp_'index' .gt. max_free then max_free = dev_sp_'index'
  126. $    endif
  127. $
  128. $    dev_n_'index' = pad_dev
  129. $    dev_f_'index' = freb
  130. $
  131. $    goto loop
  132. $
  133. $ exit_loop:
  134. $
  135. $    if p2 .eqs. "" then p2 = max_free
  136. $
  137. $    if p3 .eqs. "" then p3 = 10000
  138. $    dang_thresh = P3
  139. $
  140. $    if max_free .gt. p2
  141. $    then
  142. $        max_free = p2
  143. $        fre_step = max_free / 5
  144. $    else
  145. $        fre_step = max_free * 110 / 500
  146. $    endif
  147. $
  148. $    scale = max_free / 50
  149. $    blocks = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  150. $
  151. $    say nor, esc, "(0lqqqqqqqqqqqqqqqwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"
  152. $    say nor, "x  DEVICE NAME  x  BLOCKS  x0                                                  x"
  153. $
  154. $    ss = 1
  155. $
  156. $ sc_loop:
  157. $
  158. $    tab = 27 + (10 * ss)
  159. $    dv = fre_step * ss
  160. $    tab = tab - f$length("''dv'")
  161. $    say esc, "[A",esc,"[''tab'C", dv, "->"
  162. $
  163. $    ss = ss + 1
  164. $    if ss .lt. 6 then goto sc_loop
  165. $
  166. $    say nor, "tqqqqqqqqqqqqqqqnqqqqqqqqqqnnwwwwwwwwwnwwwwwwwwwnwwwwwwwwwnwwwwwwwwwnwwwwwwwwwnu",esc,"(B"
  167. $
  168. $    disks = index
  169. $    index = 0
  170. $    all_qs = "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"
  171. $    spaces = "                                                   "
  172. $    max_bar = ""
  173. $
  174. $    if "''old_df_para'" .eqs. P1
  175. $    then
  176. $        gosub set_df_date
  177. $    else
  178. $        dev_sp_date == ""
  179. $        gosub set_df_date
  180. $    endif
  181. $
  182. $ disk_loop:
  183. $
  184. $    index = index + 1
  185. $    if index .gt. disks then goto exit_disk_loop
  186. $
  187. $    pad_len = 7
  188. $    pad_buf = dev_f_'index'
  189. $    gosub pad_it
  190. $
  191. $    dn = dev_n_'index'
  192. $
  193. $    spdir1 = " "
  194. $    spdir2 = " "
  195. $
  196. $    if "''old_df_para'" .eqs. P1
  197. $    then
  198. $        old_df = dev_of_'index'
  199. $        if old_df .gt. dev_f_'index'
  200. $        then
  201. $            spdir1 = esc + "[7m-"
  202. $        else
  203. $            if old_df .lt. dev_f_'index'
  204. $            then
  205. $                spdir2 = esc + "[7m+"
  206. $            endif
  207. $        endif
  208. $    endif
  209. $
  210. $    dev_of_'index' == dev_f_'index'
  211. $
  212. $    spbar = dev_sp_'index' / scale
  213. $    if spbar .eq. 0 then spbar = 1
  214. $    bar = f$extract(0,spbar-1,all_qs) + "u"
  215. $    bar = f$extract(0,51,bar + spaces)
  216. $
  217. $    if dev_f_'index' .gt. max_free
  218. $    then
  219. $        bar1 = max_bar
  220. $        bar2 = ""
  221. $    else
  222. $        barlen = dev_f_'index' / scale
  223. $        if barlen .eq. 0 then barlen = 1
  224. $        bar1 = f$extract(0, barlen, bar)
  225. $        bar2 = f$extract(barlen,51, bar)
  226. $    endif
  227. $
  228. $    lo = esc + "[0m"
  229. $    if dev_f_'index' .le. dang_thresh then lo = esc + "[1m"
  230. $    if dev_f_'index' .le. (dang_thresh / 10) then lo = esc + "[1m" + esc + "[5m"
  231. $
  232. $    say nor, esc, "(0x''lo'''dn'", esc, "[0mx''lo'''spdir1'", esc, "[0m''lo'''pad_buf' ", -
  233.          "''spdir2'", esc, "[0mx''lo'", esc, "[7m''bar1'", esc, "[0m''lo'''bar2'", esc, "[0mx", esc, "(B"
  234. $
  235. $    goto disk_loop
  236. $
  237. $ exit_disk_loop:
  238. $                       
  239. $    say nor, esc, "(0mqqqqqqqqqqqqqqqvqqqqqqqqqqvvqqqqqqqqqvqqqqqqqqqvqqqqqqqqqvqqqqqqqqqvqqqqqqqqqvj", esc, "(B"
  240. $
  241. $    old_df_para == P1
  242. $
  243. $    exit
  244. $
  245. $ pad_it:
  246. $
  247. $    if f$length(pad_buf) .eq. pad_len then return
  248. $    pad_buf = "                                            ''pad_buf'"
  249. $    pad_buf = f$extract(f$length(pad_buf) - pad_len, pad_len, pad_buf)
  250. $    return
  251. $
  252. $ set_df_date:
  253. $
  254. $    if "''dev_sp_date'" .eqs. f$extract(0,11,f$time()) then return
  255. $
  256. $    dev_sp_date == f$extract(0,11,f$time())
  257. $
  258. $    spi = 1
  259. $
  260. $ loop:
  261. $
  262. $    dev_sp_'spi' == dev_f_'spi'
  263. $
  264. $    spi = spi + 1
  265. $    if spi .le. disks then goto loop
  266. $
  267. $    return
  268.