home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / perl / scripts-osu / dusage.shar < prev    next >
Encoding:
Internet Message Format  |  1991-02-27  |  19.2 KB

  1. Path: tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!hp4nl!mhres!squirrel!pronto!jv
  2. From: jv@mh.nl (Johan Vromans)
  3. Newsgroups: comp.lang.perl,alt.sources
  4. Subject: dusage.pl (Was: Re: monitoring disk usage...)
  5. Message-ID: <1991Feb28.104805.24928@pronto.mh.nl>
  6. Date: 28 Feb 91 10:48:05 GMT
  7. Sender: jv@pronto.mh.nl (Johan Vromans)
  8. Reply-To: Johan Vromans <jv@mh.nl>
  9. Organization: Multihouse Automation, the Netherlands
  10. Lines: 663
  11. Xref: tut.cis.ohio-state.edu comp.lang.perl:4528 alt.sources:3309
  12.  
  13. In article <4bmMK9O00j6949bmNF@andrew.cmu.edu> jb3o+@andrew.cmu.edu (Jon Allen Boone) writes:
  14.  
  15.    Not having recieved my copy of Programming perl yet, can anyone send me
  16.    a program which will find the free space on mounted volumes (via df?),
  17.    sort them (so that the output is the same regardless of machine run
  18.    from), compare the free space left with the amount last reported (from
  19.    the end of a file), return the percentage change (up or down) in disk
  20.    usage for individual file systems, percentage change (up or down) in
  21.    total disk usage, and report the raw amount (stdout & append to file
  22.    mentioned earlier).
  23.  
  24. Reposting time ... (actually, this is an updated version).
  25.  
  26. Submitted-by: jv@mh.nl
  27. Archive-name: dusage/part01
  28.  
  29. ---- Cut Here and feed the following to sh ----
  30. #!/bin/sh
  31. # This is dusage, a shell archive (produced by shar 3.49)
  32. # To extract the files from this archive, save it to a file, remove
  33. # everything above the "!/bin/sh" line above, and type "sh file_name".
  34. #
  35. # made 02/28/1991 10:46 UTC by jv@largo.mh.nl
  36. # Source directory /u1/users/jv/src/dusage
  37. #
  38. # existing files WILL be overwritten
  39. #
  40. # This shar contains:
  41. # length  mode       name
  42. # ------ ---------- ------------------------------------------
  43. #    278 -rw-r--r-- Makefile
  44. #  10109 -r--r--r-- dusage.pl
  45. #   5139 -r--r--r-- dusage.1
  46. #    397 -rw-r--r-- dusage.ctl
  47. #
  48. # ============= Makefile ==============
  49. echo 'x - extracting Makefile (Text)'
  50. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  51. SHELL    = /bin/sh
  52. SRC    = Makefile dusage.pl dusage.1 dusage.ctl
  53. X
  54. dusage:    dusage.ctl
  55. X    cp dusage.pl dusage
  56. X    chmod 0755 dusage
  57. X
  58. install:    dusage
  59. X    install -c -m 0755 dusage /usr/local/bin/dusage
  60. X
  61. DOMAIN    = .mh.nl
  62. shar:
  63. X    shar -acxf -ndusage -sjv@`hostname`$(DOMAIN) -o dusage.shar $(SRC)
  64. SHAR_EOF
  65. chmod 0644 Makefile ||
  66. echo 'restore of Makefile failed'
  67. Wc_c="`wc -c < 'Makefile'`"
  68. test 278 -eq "$Wc_c" ||
  69.     echo 'Makefile: original size 278, current size' "$Wc_c"
  70. # ============= dusage.pl ==============
  71. echo 'x - extracting dusage.pl (Text)'
  72. sed 's/^X//' << 'SHAR_EOF' > 'dusage.pl' &&
  73. #!/usr/bin/perl
  74. #
  75. # dusage.pl -- gather disk usage statistics
  76. # SCCS Status     : @(#)@ dusage    1.9
  77. # Author          : Johan Vromans
  78. # Created On      : Sun Jul  1 21:49:37 1990
  79. # Last Modified By: Johan Vromans
  80. # Last Modified On: Tue Feb 19 16:41:23 1991
  81. # Update Count    : 3
  82. # Status          : OK
  83. #
  84. # This program requires perl version 3.0, patchlevel 12 or higher.
  85. #
  86. # Copyright 1990,1991 Johan Vromans, all rights reserved.
  87. # This program may be used, modified and distributed as long as
  88. # this copyright notice remains part of the source. It may not be sold, or 
  89. # be used to harm any living creature including the world and the universe.
  90. X
  91. $my_name = $0;
  92. X
  93. ################ usage ################
  94. X
  95. sub usage {
  96. X  local ($help) = shift (@_);
  97. X  local ($usg) = "usage: $my_name [-afghruD][-i input][-p dir] ctlfile";
  98. X  die "$usg\nstopped" unless $help;
  99. X  print STDERR "$usg\n";
  100. X  print STDERR <<EndOfHelp
  101. X
  102. X    -D          - provide debugging info
  103. X    -a          - provide all statis
  104. X    -f          - also report file statistics
  105. X    -g          - gather new data
  106. X    -h          - this help message
  107. X    -i input    - input data as obtained by 'du dir' [def = 'du dir']
  108. X    -p dir      - path to which files in the control file are relative
  109. X    -r          - do not discard entries which don't have data
  110. X    -u          - update the control file with new values
  111. X    ctlfile     - file which controls which dirs to report [def = dir/.du.ctl]
  112. EndOfHelp
  113. X  ;
  114. X  exit 1;
  115. }
  116. X
  117. ################ main stream ################
  118. X
  119. &do_get_options;        # process options
  120. &do_parse_ctl;            # read the control file
  121. &do_gather if $gather;        # gather new info
  122. &do_report_and_update;        # report and update
  123. X
  124. ################ end of main stream ################
  125. X
  126. ################ other subroutines ################
  127. X
  128. sub do_get_options {
  129. X
  130. X  # Default values for options
  131. X
  132. X  $debug = 0;
  133. X  $noupdate = 1;
  134. X  $retain = 0;
  135. X  $gather = 0;
  136. X  $allfiles = 0;
  137. X  $allstats = 0;
  138. X
  139. X  # Command line options. We use a modified version of getopts.pl.
  140. X
  141. X  do "getopts.pl" || die "Cannot load getopts.pl, stopped";
  142. X  die $@ if $@;
  143. X
  144. X  &usage (0) if !&Getopts ("Dafghi:p:ru");
  145. X  &usage (1) if $opt_h;
  146. X  &usage (0) if $#ARGV > 0;
  147. X
  148. X  $debug    |= $opt_D if defined $opt_D;    # -D -> debug
  149. X  $allstats |= $opt_a if defined $opt_a;    # -a -> all stats
  150. X  $allfiles |= $opt_f if defined $opt_f;    # -f -> report all files
  151. X  $gather   |= $opt_g if defined $opt_g;    # -g -> gather new data
  152. X  $retain   |= $opt_r if defined $opt_r;    # -r -> retain old entries
  153. X  $noupdate = !$opt_u if defined $opt_u;    # -u -> update the control file
  154. X  $du        = $opt_i if defined $opt_i;    # -i input file
  155. X  if ( defined $opt_p ) {            # -p path
  156. X    $root = $opt_p;
  157. X    $root = $` while ($root =~ m|/$|);
  158. X    $prefix = "$root/";
  159. X    $root = "/" if $root eq "";
  160. X  }
  161. X  else {
  162. X    $prefix = $root = "";
  163. X  }
  164. X  $table    = ($#ARGV == 0) ? shift (@ARGV) : "$prefix.du.ctl";
  165. X  $runtype = $allfiles ? "file" : "directory";
  166. X  if ($debug) {
  167. X    print STDERR "@(#)@ dusage    1.9 - dusage.pl\n";
  168. X    print STDERR "Options:";
  169. X    print STDERR " debug" if $debug;    # silly, isn't it...
  170. X    print STDERR $noupdate ? " no" : " ", "update";
  171. X    print STDERR $retain ? " " : " no", "retain";
  172. X    print STDERR $gather ? " " : " no", "gather";
  173. X    print STDERR $allstats ? " " : " no", "allstats";
  174. X    print STDERR "\n";
  175. X    print STDERR "Root = $root [prefix = $prefix]\n";
  176. X    print STDERR "Control file = $table\n";
  177. X    print STDERR "Input data = $du\n" if defined $du;
  178. X    print STDERR "Run type = $runtype\n";
  179. X    print STDERR "\n";
  180. X  }
  181. }
  182. X
  183. sub do_parse_ctl {
  184. X
  185. X  # Parsing the control file.
  186. X  #
  187. X  # This file contains the names of the (sub)directories to tally,
  188. X  # and the values dereived from previous runs.
  189. X  # The names of the directories are relative to the $root.
  190. X  # The name may contain '*' or '?' characters, and will be globbed if so.
  191. X  # An entry starting with ! is excluded.
  192. X  #
  193. X  # To add a new dir, just add the name. The special name '.' may 
  194. X  # be used to denote the $root directory. If used, '-p' must be
  195. X  # specified.
  196. X  #
  197. X  # Upon completion:
  198. X  #  - %oldblocks is filled with the previous values,
  199. X  #    colon separated, for each directory.
  200. X  #  - @targets contains a list of names to be looked for. These include
  201. X  #    break indications and globs info, which will be stripped from
  202. X  #    the actual search list.
  203. X
  204. X  open (tb, "<$table") || die "Cannot open control file $table, stopped";
  205. X  @targets = ();
  206. X  %oldblocks = ();
  207. X  %newblocks = ();
  208. X
  209. X  while ($tb = <tb>) {
  210. X    chop ($tb);
  211. X
  212. X    # preferred syntax: <dir><TAB><size>:<size>:....
  213. X    # allowable          <dir><TAB><size> <size> ...
  214. X    # possible          <dir>
  215. X
  216. X    if ( $tb =~ /^-/ ) {    # break
  217. X      push (@targets, "$tb");
  218. X      printf STDERR "tb: *break* $tb\n" if $debug;
  219. X      next;
  220. X    }
  221. X
  222. X    if ( $tb =~ /^!/ ) {    # exclude
  223. X      $excl = $';        #';
  224. X      @a = grep ($_ ne $excl, @targets);
  225. X      @targets = @a;
  226. X      push (@targets, "*$tb");
  227. X      printf STDERR "tb: *excl* $tb\n" if $debug;
  228. X      next;
  229. X    }
  230. X
  231. X    if ($tb =~ /^(.+)\t([\d: ]+)/) {
  232. X      $name = $1;
  233. X      @blocks = split (/[ :]/, $2);
  234. X    }
  235. X    else {
  236. X      $name = $tb;
  237. X      @blocks = ("","","","","","","","");
  238. X    }
  239. X
  240. X    if ($name eq ".") {
  241. X      if ( $root eq "" ) {
  242. X    printf STDERR "Warning: \".\" in control file w/o \"-p path\" - ignored\n";
  243. X    next;
  244. X      }
  245. X      $name = $root;
  246. X    } else {
  247. X      $name = $prefix . $name unless ord($name) == ord ("/");
  248. X    }
  249. X
  250. X    # Check for globs ...
  251. X    if ( $gather && $name =~ /\*|\?/ ) {
  252. X      print STDERR "glob: $name\n" if $debug;
  253. X      foreach $n ( <${name}> ) {
  254. X    next unless $allfiles || -d $n;
  255. X    # Globs never overwrite existing entries
  256. X    if ( !defined $oldblocks{$n} ) {
  257. X      $oldblocks{$n} = ":::::::";
  258. X      push (@targets, $n);
  259. X    }
  260. X    printf STDERR "glob: -> $n\n" if $debug;
  261. X      }
  262. X      # Put on the globs list, and terminate this entry
  263. X      push (@targets, "*$name");
  264. X      next;
  265. X    }
  266. X
  267. X    push (@targets, "$name");
  268. X    # Entry may be rewritten (in case of globs)
  269. X    $oldblocks{$name} = join (":", @blocks[0..7]);
  270. X
  271. X    print STDERR "tb: $name\t$oldblocks{$name}\n" if $debug;
  272. X  }
  273. X  close (tb);
  274. }
  275. X
  276. sub do_gather {
  277. X
  278. X  # Build a targets match string, and an optimized list of directories to
  279. X  # search.
  280. X  $targets = "//";
  281. X  @list = ();
  282. X  $last = "///";
  283. X  foreach $name (sort (@targets)) {
  284. X    next if $name =~ /^[-*]/;
  285. X    next unless $allfiles || -d $name;
  286. X    $targets .= "$name//"; 
  287. X    next if ($name =~ m|^$last/|);
  288. X    push (@list, $name);
  289. X    ($last = $name) =~ s/(\W)/\\$1/g; # protect regexp chars in dir names
  290. X  }
  291. X
  292. X  print STDERR "targets: $targets\n" if $debug;
  293. X  print STDERR "list: @list\n" if $debug;
  294. X  print STDERR "reports: @targets\n" if $debug;
  295. X
  296. X  $du = "du " . ($allfiles ? "-a" : "") . " @list|"
  297. X    unless defined $du; # in which case we have a data file
  298. X
  299. X  # Process the data. If a name is found in the target list, 
  300. X  # %newblocks will be set to the new blocks value.
  301. X
  302. X  open (du, "$du") || die "Cannot get data from $du, stopped";
  303. X  while ($du = <du>) {
  304. X    chop ($du);
  305. X    ($blocks,$name) = split (/\t/, $du);
  306. X    if (($i = index ($targets, "//$name//")) >= 0) {
  307. X      # tally and remove entry from search list
  308. X      $newblocks{$name} = $blocks;
  309. X      print STDERR "du: $name $blocks\n" if $debug;
  310. X      substr ($targets, $i, length($name) + 2) = "";
  311. X    }
  312. X  }
  313. X  close (du);
  314. }
  315. X
  316. X
  317. # Report generation
  318. X
  319. format std_hdr =
  320. Disk usage statistics@<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<
  321. $subtitle, $date
  322. X
  323. X blocks    +day     +week  @<<<<<<<<<<<<<<<
  324. $runtype
  325. -------  -------  -------  --------------------------------
  326. .
  327. format std_out =
  328. @>>>>>> @>>>>>>> @>>>>>>>  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<..
  329. $blocks, $d_day, $d_week, $name
  330. .
  331. X
  332. format all_hdr =
  333. Disk usage statistics@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<           @<<<<<<<<<<<<<<<
  334. $subtitle, $date
  335. X
  336. X --0--    --1--    --2--    --3--    --4--    --5--    --6--    --7--   @<<<<<<<<<<<<<<<
  337. $runtype
  338. -------  -------  -------  -------  -------  -------  -------  -------  --------------------------------
  339. .
  340. format all_out =
  341. @>>>>>> @>>>>>>> @>>>>>>> @>>>>>>> @>>>>>>> @>>>>>>> @>>>>>>> @>>>>>>>  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<..
  342. $a[0],  $a[1],   $a[2],   $a[3],   $a[4],   $a[5],   $a[6],   $a[7],    $name
  343. .
  344. X
  345. sub do_report_and_update {
  346. X
  347. X  # Prepare update of the control file
  348. X  if ( !$noupdate ) {
  349. X    if ( !open (tb, ">$table") ) {
  350. X      print STDERR "Warning: cannot update control file $table - continuing\n";
  351. X      $noupdate = 1;
  352. X    }
  353. X  }
  354. X
  355. X  if ( $allstats ) {
  356. X    $^ = "all_hdr";
  357. X    $~ = "all_out";
  358. X  }
  359. X  else {
  360. X    $^ = "std_hdr";
  361. X    $~ = "std_out";
  362. X  }
  363. X  $date = `date`;
  364. X  chop ($date);
  365. X
  366. X  # In one pass the report is generated, and the control file rewritten.
  367. X
  368. X  foreach $name (@targets) {
  369. X    if ($name =~ /^-/ ) {
  370. X      $subtitle = $';                #';
  371. X      print tb "$name\n" unless $noupdate;
  372. X      print STDERR "tb: $name\n" if $debug;
  373. X      $- = -1;
  374. X      next;
  375. X    }
  376. X    if ($name  =~ /^\*$prefix/ ) {
  377. X      print tb "$'\n" unless $noupdate;        #';
  378. X      print STDERR "tb: $'\n" if $debug;    #';
  379. X      next;
  380. X    }
  381. X    @a = split (/:/, $oldblocks{$name});
  382. X    unshift (@a, $newblocks{$name}) if $gather;
  383. X    $name = "." if $name eq $root;
  384. X    $name = $' if $name =~ /^$prefix/;        #';
  385. X    print STDERR "Warning: ", 1+$#a, " entries for $name\n"
  386. X      if ($debug && $#a != 8);
  387. X
  388. X    # check for valid data
  389. X    $try = join(":",@a[0..7]);
  390. X    if ( $try eq ":::::::") {
  391. X      if ($retain) {
  392. X    @a = ("","","","","","","","");
  393. X      }
  394. X      else {
  395. X    # Discard
  396. X    print STDERR "--: $name\n" if $debug;
  397. X    next;
  398. X      }
  399. X    }
  400. X
  401. X    $line = "$name\t$try\n";
  402. X    print tb $line unless $noupdate;
  403. X    print STDERR "tb: $line" if $debug;
  404. X
  405. X    $blocks = $a[0];
  406. X    if ( !$allstats ) {
  407. X      $d_day = $d_week = "";
  408. X      if ($blocks ne "") {
  409. X    if ($a[1] ne "") {        # dayly delta
  410. X      $d_day = $blocks - $a[1];
  411. X      $d_day = "+" . $d_day if $d_day > 0;
  412. X    }
  413. X    if ($a[7] ne "") {        # weekly delta
  414. X      $d_week = $blocks - $a[7];
  415. X      $d_week = "+" . $d_week if $d_week > 0;
  416. X    }
  417. X      }
  418. X    }
  419. X    write;
  420. X  }
  421. X
  422. X  # Close control file, if opened
  423. X  close (tb) unless $noupdate;
  424. }
  425. X
  426. # Emacs support
  427. # Local Variables:
  428. # mode:perl
  429. # eval:(headers)
  430. # End:
  431. SHAR_EOF
  432. chmod 0444 dusage.pl ||
  433. echo 'restore of dusage.pl failed'
  434. Wc_c="`wc -c < 'dusage.pl'`"
  435. test 10109 -eq "$Wc_c" ||
  436.     echo 'dusage.pl: original size 10109, current size' "$Wc_c"
  437. # ============= dusage.1 ==============
  438. echo 'x - extracting dusage.1 (Text)'
  439. sed 's/^X//' << 'SHAR_EOF' > 'dusage.1' &&
  440. .TH DUSAGE 1
  441. .SH NAME
  442. dusage \- provide disk usage statistics
  443. .SH SYNOPSIS
  444. .B dusage
  445. .RB [ \-afghruD ]
  446. .RI "[\fB\-i\fR" " input" ]
  447. .RI "[\fB\-p\fR" " dir" ]
  448. .RI [ "control file" ]
  449. .SH DESCRIPTION
  450. .I Dusage
  451. is a perl script which produces disk usage statistics. These
  452. statistics include the number of blocks, the increment since the previous run
  453. (which is assumed to be yesterday if run daily), and the increment
  454. since 7 runs ago (which could be interpreted as a week if run daily).
  455. .I Dusage
  456. is driven by a 
  457. .IR "control file" ,
  458. which describes the names of the files (directories) to be reported,
  459. and which also contains the results of previous runs.
  460. .PP
  461. When
  462. .I dusage
  463. is run, it reads the
  464. .IR "control file" ,
  465. [optionally] gathers new disk usage values by calling
  466. .IR du (1),
  467. prints the report, and [optionally] updates the
  468. .I control file
  469. with the new information.
  470. .PP
  471. Filenames in the control file may have wildcards. In this case, the
  472. wildcards are expanded, and all entries reported. Both the expanded
  473. names as the wildcard info are maintained in the control file. New
  474. files in these directories will automatically show up, deleted files
  475. will disappear when they have run out of data in the control file (but
  476. see the 
  477. .B \-r
  478. option).
  479. .br
  480. Wildcard expansion only adds filenames which are not already on the list.
  481. .PP
  482. The control file may also contain filenames preceded with an
  483. exclamation mark ``!''; these entries are skipped. This is meaningful
  484. in conjunction with wildcards, to exclude entries which result from a
  485. wildcard expansion.
  486. .PP
  487. The control file may have lines starting with a dash ``\-'',
  488. which causes the report to start on a new page. Any text following the
  489. dash is placed in the page header, immediately following the text
  490. ``Disk usage statistics''.
  491. .PP
  492. The available command line options are:
  493. .TP 5
  494. .B \-D
  495. Turns on debugging, which yields lots of trace information.
  496. .TP
  497. .B \-a
  498. Reports the statistics for this and all previous runs, as opposed to
  499. the normal case, which is to generate the statistics for this run, and
  500. the differences between the previous and 7th previous run.
  501. .TP
  502. .B \-f
  503. Reports file statistics also. Default is to only report directories.
  504. .TP
  505. .B \-g
  506. Gathers new data by calling 
  507. .IR du (1).
  508. .TP
  509. .B \-h
  510. Provides a help message. No work is done.
  511. .TP
  512. .BI \-i " input"
  513. Uses
  514. .I input
  515. as data obtained by calling
  516. .IR du (1).
  517. .TP
  518. .BI \-p " dir"
  519. All filenames in the control file are interpreted relative to this
  520. directory.
  521. .TP
  522. .B \-r
  523. Retains entries which don't have any data anymore. If this option is
  524. not used, entries without data are not reported, and removed from the
  525. control file.
  526. .TP
  527. .B \-u
  528. Update the control file with new values.
  529. .PP
  530. The default name for the control file is
  531. .BR .du.ctl ,
  532. optionally preceded by the name supplied with the
  533. .B \-p
  534. option.
  535. .SH EXAMPLES
  536. Given the following control file:
  537. .sp
  538. .nf
  539. .ne 3
  540. .in +.5i
  541. \- for manual page
  542. maildir
  543. maildir/*
  544. !maildir/unimportant
  545. src
  546. .in
  547. .fi
  548. .sp
  549. This will generate the following (example) report when running the
  550. command ``dusage -gu controlfile'':
  551. .sp
  552. .nf
  553. .ne 7
  554. .in +.5i
  555. Disk usage statistics for manual page      Wed Jan 10 13:38
  556. X
  557. X blocks    +day     +week  directory
  558. -------  -------  -------  --------------------------------
  559. X   6518                    maildir
  560. X      2                    maildir/dirent
  561. X    498                    src
  562. .in
  563. .fi
  564. .sp
  565. After updating the control file, it will contain:
  566. .sp
  567. .nf
  568. .ne 4
  569. .in +.5i
  570. \- for manual page
  571. maildir 6518::::::
  572. maildir/dirent  2::::::
  573. maildir/*
  574. !maildir/unimportant
  575. src     498::::::
  576. .in
  577. .fi
  578. .sp
  579. The names in the control file are separated by the values with a TAB;
  580. the values are separated with colons. Also, the entries found by
  581. expanding the wildcard are added. If the wildcard expansion had
  582. generated a name ``maildir/unimportant'' it would have been skipped.
  583. .br
  584. When the program is rerun after one day, it could print the following
  585. report:
  586. .sp
  587. .nf
  588. .ne 7
  589. .in +.5i
  590. Disk usage statistics for manual page      Wed Jan 10 13:38
  591. X
  592. X blocks    +day     +week  directory
  593. -------  -------  -------  --------------------------------
  594. X   6524       +6           maildir
  595. X      2        0           maildir/dirent
  596. X    486      -12           src
  597. .in
  598. .fi
  599. .sp
  600. The control file will contain:
  601. .sp
  602. .nf
  603. .ne 4
  604. .in +.5i
  605. \- for manual page
  606. maildir 6524:6518:::::
  607. maildir/dirent  2:2:::::
  608. maildir/*
  609. !maildir/unimportant
  610. src     486:498:::::
  611. .in
  612. .fi
  613. .sp
  614. It takes very little fantasy to imagine what will happen on subsequent
  615. runs...
  616. .PP
  617. When the contents of the control file are to be changed, e.g. to add
  618. new filenames, a normal text editor can be used. Just add or remove
  619. lines, and they will be taken into account automatically.
  620. .PP
  621. When run without 
  622. .B \-g
  623. or
  624. .B \-u
  625. options, it actually reproduces the report from the previous run.
  626. .PP
  627. When multiple runs are required, save the output of
  628. .IR du (1)
  629. in a file, and pass this file to
  630. .I dusage
  631. using the 
  632. .BI \-i "file"
  633. option.
  634. .SH BUGS
  635. Running the same control file with different values of the 
  636. .B \-f
  637. and
  638. .B \-r
  639. options may cause strange results.
  640. .SH AUTHOR
  641. Johan Vromans, Multihouse Research, Gouda, The Netherlands.
  642. .sp
  643. Send bugs and remarks to <jv@mh.nl> .
  644. SHAR_EOF
  645. chmod 0444 dusage.1 ||
  646. echo 'restore of dusage.1 failed'
  647. Wc_c="`wc -c < 'dusage.1'`"
  648. test 5139 -eq "$Wc_c" ||
  649.     echo 'dusage.1: original size 5139, current size' "$Wc_c"
  650. # ============= dusage.ctl ==============
  651. echo 'x - extracting dusage.ctl (Text)'
  652. sed 's/^X//' << 'SHAR_EOF' > 'dusage.ctl' &&
  653. - for /usr/spool
  654. /usr/spool/batch    2:2:2:2:2:2:2:2
  655. /usr/spool/cron    16:16:16:16:16:16:16:16
  656. /usr/spool/locks    2:2:2:2:2:2:2:2
  657. /usr/spool/lp    570:570:570:570:570:244:240:238
  658. /usr/spool/mqueue    2:2:2:2:2:2:2:2
  659. /usr/spool/news    2:2:2:2:2:2:2:2
  660. /usr/spool/rwho    20:20:20:20:20:20:20:20
  661. /usr/spool/uucp    3188:2964:3484:2836:2890:2222:2128:2072
  662. /usr/spool/uucppublic    14:14:16:16:16:16:16:16
  663. !/usr/spool/oldnews
  664. SHAR_EOF
  665. chmod 0644 dusage.ctl ||
  666. echo 'restore of dusage.ctl failed'
  667. Wc_c="`wc -c < 'dusage.ctl'`"
  668. test 397 -eq "$Wc_c" ||
  669.     echo 'dusage.ctl: original size 397, current size' "$Wc_c"
  670. exit 0
  671. -- 
  672. Johan Vromans                       jv@mh.nl via internet backbones
  673. Multihouse Automatisering bv               uucp: ..!{uunet,hp4nl}!mh.nl!jv
  674. Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
  675. ------------------------ "Arms are made for hugging" -------------------------
  676.  
  677.