R
Rocky Allen
I have an odd problem with the $file variable listed in the loop below
the syntax of unix split command is as follows:
Usage: split [OPTION] [INPUT [PREFIX]] and split will default to "x" as a
prefix
here is the output of this script (i ^c it)
found file rallen.tar.gz
error splitting file rallen.tar.gz
:2 at ./perl-ATSDailyback line 49.
it remembers the $file variable before and after the system command runs,
but it doesnt add "$file." as a prefix
any thoughts?
thanks in advance
#!/usr/bin/perl
use strict;
use warnings;
use Sys::Hostname;
use POSIX qw/strftime/;
my $error ;
my @errors;
my @filestobackup;
# Variables. This section will need to be modified for each Cooperative.
my $host = hostname;
my $jobstart = localtime();
my $fileformat = strftime('contents-%Y-%m-%d_%H:%M:%S', localtime);
my $contentsfile = "/etc/backup/$fileformat";
my $errorfile = '/tmp/cpioerrors';
my @dirs = ('/working');
my $finderrors = '/tmp/finderrors';
my @largefiles;
#my @tapestat = `mt -f /dev/st0 status`;
#if (scalar(@tapestat) == 0) {
# print "No tape in drive or no tape device on server\n";
# exit 0;
#}
foreach my $backupdir (@dirs) {
chdir($backupdir);
@largefiles = `find . -follow -size +2147483648c -print 2>/tmp/largefilerr`;
foreach my $file (@largefiles) {
$file =~ s/\.\///;
print "found file $file";
system("split -d --bytes=2000000000 $file $file.") == 0 or die "error splitting file $file:$?";
}
@filestobackup = `find $backupdir -follow -print 2> $finderrors`;
}
the syntax of unix split command is as follows:
Usage: split [OPTION] [INPUT [PREFIX]] and split will default to "x" as a
prefix
here is the output of this script (i ^c it)
found file rallen.tar.gz
error splitting file rallen.tar.gz
:2 at ./perl-ATSDailyback line 49.
it remembers the $file variable before and after the system command runs,
but it doesnt add "$file." as a prefix
any thoughts?
thanks in advance
#!/usr/bin/perl
use strict;
use warnings;
use Sys::Hostname;
use POSIX qw/strftime/;
my $error ;
my @errors;
my @filestobackup;
# Variables. This section will need to be modified for each Cooperative.
my $host = hostname;
my $jobstart = localtime();
my $fileformat = strftime('contents-%Y-%m-%d_%H:%M:%S', localtime);
my $contentsfile = "/etc/backup/$fileformat";
my $errorfile = '/tmp/cpioerrors';
my @dirs = ('/working');
my $finderrors = '/tmp/finderrors';
my @largefiles;
#my @tapestat = `mt -f /dev/st0 status`;
#if (scalar(@tapestat) == 0) {
# print "No tape in drive or no tape device on server\n";
# exit 0;
#}
foreach my $backupdir (@dirs) {
chdir($backupdir);
@largefiles = `find . -follow -size +2147483648c -print 2>/tmp/largefilerr`;
foreach my $file (@largefiles) {
$file =~ s/\.\///;
print "found file $file";
system("split -d --bytes=2000000000 $file $file.") == 0 or die "error splitting file $file:$?";
}
@filestobackup = `find $backupdir -follow -print 2> $finderrors`;
}