I have this script to uvscan-update. Seems like that i am getting logical error at the end of the script. It is updating the script and also giving the error message to update it manually. I have deleted the DAT files to see if it will create new and it does. Below is the error and the script:
error:
/bin# ./update-uvscan.pl
Currently installed version:
Version on ftp://ftp.mcafee.com/pub/antivirus/datfiles/4.x: 5945
Updating virus data files...
Download complete...updating now
mv legal.txt /usr/local/uvscan/legal.txt
mv avvclean.dat /usr/local/uvscan/avvclean.dat
mv avvnames.dat /usr/local/uvscan/avvnames.dat
mv avvscan.dat /usr/local/uvscan/avvscan.dat
Error in installation, please install manually
Cleaning up
Script:
Code:
#!/usr/bin/perl -w
# uvscan virus DAT file updater written by
# edit by makhan
# 04072010
#
# Net::FTP is required for operation
# and 'tar' should be in the PATH
use strict;
# Set to the directory uvscan is located/installed in.
my $uvscan_directory = "/usr/local/uvscan";
# Set to the temporary directory to download
# the DAT archive.
my $tempdir = "/tmp/dat-updates";
# Set to e-mail address for anonymous FTP login
#my $emailaddress = "makhan";
my $emailaddress = "anonymous";
use Net::FTP;
# Define global variables
my ($ftp, @dirlist, $arraywalk, $localver, $serverver, $localfile,
@files, $file);
# Get the local uvscan datfile version
$localver = &checkuvscanver;
print "Currently installed version: ".$localver."\n";
# Create FTP connection
$ftp = Net::FTP->new("ftp.nai.com", Debug => 0);
# Login
#$ftp->login("anonymous","$Password");
#$ftp->login("anonymous",$emailaddress);
$ftp->login("anonymous",$emailaddress);
$ftp->cwd("/pub/antivirus/datfiles/4.x");
$ftp->binary();
@dirlist = $ftp->ls();
foreach $arraywalk (@dirlist) {
if ($arraywalk =~ /dat-([0-9]+)\.tar/i) {
$serverver = $1;
print "Version on ftp://ftp.mcafee.com/pub/antivirus/datfiles/4.x: ".$serverver."\n";
if ($serverver > $localver) {
print "Updating virus data files...\n";
# Create and then change the working directory to $tempdir
if (!(-d $tempdir)) {
mkdir($tempdir, 700) or die("ERROR: Couldn't make temporary
directory: $tempdir");
}
chdir $tempdir or die("ERROR: Couldn't change directory to tempdir:
$tempdir");
# Download the DAT file!
$localfile = $ftp->get($arraywalk);
print "Download complete...updating now\n";
# Untar the files, store the names of them into an array
@files = `tar -xvf $arraywalk`;
foreach $file (@files) {
# A line break is at the end of each $file...
# chomp that off
chomp($file);
# Move each file to the uvscan_directory;
# and make sure they are lowercase.
my $movestring = "mv $file ".$uvscan_directory."/".lc($file);
print " ".$movestring."\n";
system($movestring);
}
# Make sure that the installation worked,
# by checking if the virus scanner reports
# the same data file version as the one we downloaded.
if (&checkuvscanver eq $serverver) {
print "Installation successful\n";
} else {
#print "Error in installation, please install manually\n";
}
# Cleanup...
print "Cleaning up\n";
# Remove downloaded DAT archive
unlink($arraywalk) or die("ERROR: Couldn't delete DAT file:
$arraywalk");
# Change to filesys root
# and remove temporary directory
chdir("/");
rmdir($tempdir) or die("ERROR: Couldn't remove tempdir: $tempdir");
} else {
#
if ($serverver < $localver) {print "DAT files are the same..no need to update\n";
}
# Don't want to continue if there is more than
# one 'dat-[0-9]+.tar' files
last;
}
}
#$ftp->quit;
# uvscan --version reports...
# "Virus data file 4229 created Oct 16 2002"
# &checkuvscanver returns the version
# of the data files.
sub checkuvscanver {
if (`$uvscan_directory/uvscan --version` =~ /Virus data file
v([0-9]+) created/) {
return $1;
}
}
}
Last edited by jim mcnamara; 04-09-2010 at 11:08 PM..
Reason: code tags please nobody can read what you posted...
You really should indent your code and not use cuddled else - } else { and so on.
I actually have trouble reading your code. Maybe a major perler can deal with it - I am a minor perler.
So, I'm into about 650 lines of some code I'm working on. So I'll try to explain instead of flooding this post. Say I have some code like this:
int main() {
int i, j;
char data;
printf("Gimme something: ");
fgets(data, INPUT_BUFF, stdin);
for (j = 0; j < data; j++){... (6 Replies)
Hi All,
I am writing a simple script to read a file and display the lines with char count between 20 and 25. I am stuck with the if condition here. Tried a lot but still getting an error on the if condition
# if &&
if &&
My script is very simple as below, not able to understand... (7 Replies)
Hi,
I have a script testor.s which takes a string as command line argument,
Contents of the script:
#!/bin/ksh -x
if ]
then
echo "error"
else
echo "correct"
fi
Here, though i provide the command line argument as "WO_STMT_05292009", it displays error
Is there... (3 Replies)
Hi Fdz,
I have to verify the length of two uids are equals to 11 or not. The conditions is both lengths should be 11.I tried with this logic expr. am unable to get correct results.(Shell script in Unix i need)
if
do
echo"Results"
done
Thanx (2 Replies)
Hi can someone please help me on this.
I need to perform this code:
Grep any lines that meets the following criteria
(A AND B) OR (A AND C)
I tried this code, but it didn't work
Grep-I "A &&B" | "A&&C" *.* $
thanks in advance (12 Replies)
frnds..
can i perform an OR operation in sed syntax ?
if yes.. how?
I need to search for some 2-3 mail addresses in multiple files and delete all those... and instead of them.. I need to insert a new mail id...( these are also other emails in that list .. which sud not be affected )
is... (8 Replies)
hi
i have the following scenario
#!/bin/sh
a=21.0
b=33.0
c=16.0
cmd=20
cmd1=30
if && ]
then
echo "problem....."
exit 1
else
echo "ok"
exit 0
fi
the issue here is the above condition is never TRUE coz a>cmd && b >cmd1 (7 Replies)
Dear Members,
I am using SCO-Unix 5.0.5. I have created 2 logical drives but some of the blocks are overlapped and are now giving warning during startup. I have used fsck to settle the problems but to no avail. Kindly help me to sort out the problem.
Thanks (3 Replies)