Using portions of David Greg's dir_size routine, I eliminated the old
routine that used the DIR command. If anyone has any issues with the script,
let me know. I've attached a copy of the latest version.
<<LIMIT.PL>>
> -----Original Message-----
> From: Joel Morgan [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 27, 2000 11:28 PM
> To: '[EMAIL PROTECTED] '
> Subject: RE: [IMail Forum] *Working* - issue warnings to users
> approaching the mailboxsize limit
>
>
> I added in the dir_list. It works great! I also added the dir_size
> routine,
> but had some trouble. Everything reported 0 as the size until I commented
> out:
>
> chdir("$l_physicaldirectory");
>
> And changed the next line to:
> opendir(THISDIR, "$l_physicaldirectory");
>
> Even then I had some trouble. Even though it printed out correctly, the
> numbers didn't trigger the warnings. I left the routine in, but commented
> it
> all out until it works better. Can you fix it? The old one though crude,
> seems to work for now.
>
> Can you change it to report only mailbox size (*.MBX), not the entire
> directory. It gets called by "$mbx_size = dir_size($dir . "\\*.mbx");"
>
> One thing I discovered is that the Imail administrator program reports the
> mailbox size as the entire directory size, while the web interface reports
> the total of all MBX files as the mailbox size.
>
> I've attached a copy of the script that has been updated to include the
> new
> dir_list routine and a two level warning system. Caution at 90% capacity
> and
> warning at 95% capacity. This is adjustable in the "$notify_window = .10
> line". Higher numbers mean users start getting warned earlier. Maybe we
> could pass this as a command line parameter.
>
> I agree, once we get the script working good it would be great if you
> compiled it. Thanks for the help everyone.
>
>
> -----Original Message-----
> From: David Gregg
> To: [EMAIL PROTECTED]
> Sent: 4/27/00 7:14 PM
> Subject: Re: [IMail Forum] *Working* - issue warnings to users
> approaching
> the mailboxsize limit
>
> Bear with me here folks. One more post of perl code that you can
> implement
> to remove the last reference to the 'DIR' command used in the latest
> version
> of limit.pl
>
> Joel, once this script has made it's rounds and everybody is happy with
> it,
> let me know and I'd be glad to compile it into an exe so the non-perl
> folks
> can benefit too.
>
> # replace the dir_size subroutine with this one and you will no longer
> have
> any dependance on the DIR command
>
> sub dir_size {
> local($l_physicaldirectory) = @_;
> local(@l_allfiles, $l_dirsize, $l_filename);
> local($l_fdev, $l_fino, $l_fmode, $l_fnlink, $l_fuid, $l_fgid,
> $l_frdev,
> $l_fsize, $l_fatime, $l_fmtime, $l_fctime, $l_fblksize, $l_fblocks);
>
> chdir("$l_physicaldirectory");
> opendir(THISDIR, ".");
> @l_allfiles = grep(!-d, readdir(THISDIR));
> closedir(THISDIR);
>
> $l_totsize = 0;
> foreach $l_filename (@l_allfiles) {
> ($l_fdev, $l_fino, $l_fmode, $l_fnlink, $l_fuid, $l_fgid, $l_frdev,
> $l_fsize, $l_fatime, $l_fmtime, $l_fctime, $l_fblksize, $l_fblocks) =
> stat("$l_physicaldirectory/$l_filename");
> $l_dirsize += $l_fsize;
> }
> return $l_dirsize;
> }
>
> << File: limit.pl >>
LIMIT.PL