[windows2000] Glenn Rocks!!

  • From: "Chris Berry" <compjma@xxxxxxxxxxx>
  • To: windows2000@xxxxxxxxxxxxx
  • Date: Wed, 07 May 2003 17:25:29 -0700

>From: "Sullivan, Glenn" <GSullivan@xxxxxxxxxxxxxx>
>D'oh... line 10 is supposed to be:
>10. set @File=%@Line:~11,40%
>That is an eleven, not a one.
>Sorry,

No sweat, I wondered why it didn't quite work, but I was so excited I 
rewrote the entire thing in perl, and made it so that it works remotely now 
(didn't want to have log into the darn server just fix it).  Had to split it 
into three small programs because of timing issues, but here it is:

fixer.plx
#!perl

`part1.plx`;

until (-s "netfile.txt") {};

`part2.plx`;

part1.plx
#!perl

my ($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst)=localtime;
$min++;
my $time="$hour:$min";
my 
$working_directory="\\\\mars\\logical\\IT_Department\\Perl\\infoUSA_Fixer";

`at \\\\mars $time cmd /c "net file > $working_directory\\netfile.txt"`;

part2.plx
#!perl

my ($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst)=localtime;
$min++;
my $time="$hour:$min";
$min++;
my $time2="$hour:$min";

open INPUT_FILE, "<netfile.txt";
while (<INPUT_FILE>) {
        $test++;
        if (m{^The}) {$test=0};
        if ($test>4) {
                @fields=split /\s+/, "$_";
                my $id=@fields[0];
                my $file=@fields[1];
                if ($file =~ m{Pu_2001.ium}) {
                        `at \\\\mars $time cmd /c "net file $id /close"`;
                }
        }
}

close INPUT_FILE;

`at \\\\mars $time2 cmd /c "copy 
\\\\mars\\pgmsdata\\infoUSA_backup\\Licensing\\Pu_2001.ium 
\\\\mars\\pgmsdata\\infoUSA\\Licensing\\Pu_2001.ium /Y"`;
`del netfile.txt`;

The only annoying part is that I couldn't figure out how to make the "at" 
command work in less than a minute, doesn't seem to be any run now switch.  
Still  It's automated now and only takes three minutes, took like 8-10 
before and I had to pay attention.  Woohoo just saved about half an hour a 
week!! Thanks Glenn.

Chris Berry
compjma@xxxxxxxxxxx
Systems Administrator
JM Associates

"This email is ROT26 encrypted, by reading it you are in violation of the 
DMCA, and should turn yourself in to the authorities immediately."

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


==================================
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts:

  • » [windows2000] Glenn Rocks!!