Hey all,
Okay, I have this script that I asked about a few days ago, that allows me
to move some log files and put a date on the filename when they are moved.
This is a script that runs daily (currently) on two machines. One server
is a test server, the other is a backup production server. Now, the
clocks on both of these servers are set to Atlantic Standard/Daylight Time
(it's for a Stock Exchange, long story short). Both scripts on the
servers run at Midnight Mon-Fri. The only difference between the two
machines, is that the log files have different names (just a couple of
numbers are different) and they connect to different servers on the other
side. Now on the test server, the script runs fine (let's say today is
the 11th, so the log file will have the date of 20010710.log which is what
I want). However, on the production box, it doesn't (meaning if today is
the 11th, the log file will be 20010711.log, which is not what I want).
Can anyone give me some ideas on why this might be happening?
Thanks,
Tom
(This is the script on the production box)
#!/usr/bin/perl -w
use strict;
use File::Copy;
# This section defines the different logfiles
my $event = "09000FIXSOM090Aevnt";
my $send = "09000FIXSOM090Asend";
my $recv = "09000FIXSOM090Arecv";
# This sets up the values for the $date variable
my($mday, $mon, $year) = (localtime)[3,4,5];
# This calls a subroutine that handles file moving at the end of the month
# so that the file for 20010630 doesn't become 20010700 for example
($mon,$mday) = &datefix($mon,$mday);
# This sets up the value of $date that we will use in the new name of the
# logfile
my $date = sprintf("%d%02d%02d", $year+1900, $mon, $mday);
# This shuts down the two services so we can move the log file
system("net stop NetProbe") or print "Couldn't stop NetProbe service
$!\n";
# This puts us in the right directory
chdir("d:/glsofts/slecmea/log");
# These lines move the respective log files to the old directory
move ("$event.log", "d:/glsofts/slecmea/log/old/$event-$date.log");
move ("$send.log", "d:/glsofts/slecmea/log/old/$send-$date.log");
move ("$recv.log", "d:/glsofts/slecmea/log/old/$recv-$date.log");
# Here we start the services back up again
system("net start NetProbe") or print "Couldn't start NetProbe service
$!\n";
# This is the subroutine that handles the last day of the month
sub datefix {
my ($month,$day) = @_;
if ($day == 1) {
my @days = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
$day = $days[$month - 1];
return ($month,$day);
} else {
$day = --$day;
$month = $month+1;
return ($month,$day);
}
}
--
#!/usr/bin/perl -w # 526-byte qrpff, Keith Winstein and Marc Horowitz
<[EMAIL PROTECTED]> # MPEG 2 PS VOB file on stdin -> descrambled output
on stdout # arguments: title key bytes in least to most-significant order
$_='while(read+STDIN,$_,2048){$a=29;$c=142;if((@a=unx"C*",$_)[20]&48){$h=5;
$_=unxb24,join"",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}@ARGV;s/...$/1$&/;$d=
unxV,xb25,$_;$b=73;$e=256|(ord$b[4])<<9|ord$b[3];$d=$d>>8^($f=($t=255)&($d
>>12^$d>>4^$d^$d/8))<<17,$e=$e>>8^($t&($g=($q=$e>>14&7^$e)^$q*8^$q<<6))<<9
,$_=(map{$_%16or$t^=$c^=($m=(11,10,116,100,11,122,20,100)[$_/16%8])&110;$t
^=(72,@z=(64,72,$a^=12*($_%16-2?0:$m&17)),$b^=$_%64?12:0,@z)[$_%8]}(16..271))
[$_]^(($h>>=8)+=$f+(~$g&$t))for@a[128..$#a]}print+x"C*",@a}';s/x/pack+/g;eval