-
Notifications
You must be signed in to change notification settings - Fork 0
/
four_tb_check_files.pl
executable file
·76 lines (51 loc) · 1.44 KB
/
four_tb_check_files.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /usr/bin/perl
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
& eval 'exec perl -w -S $0 $argv:q'
if 0;
require 5.006;
use strict;
use FindBin;
use File::Spec;
use File::Find;
use File::Basename;
use Getopt::Long;
use File::stat;
use Pod::Usage;
my $scriptname = basename($0);
# Getopt::Long::Configure ("bundling_override");
Getopt::Long::Configure ('pass_through');
my $man = 0;
my $help = 0;
my $left_over_args;
my $ret;
($ret, $left_over_args) = GetOptions('help|?' => \$help,
'man' => \$man) or pod2usage(2);
pod2usage(1) if $help;
pod2usage(-exitstatus => 0, -verbose => 2) if $man;
my $command;
my @files = `ssh root\@nwb-devnas02 cd /volume1 && find Transfer -type f`;
foreach my $file (@files)
{
if (! -e $file)
{
$command = "scp root\@nwb-devnas02:/volume1/$file $file";
system($command) eq 0 or die "Error command: $command failed.";
print "Copied $file OK!\n";
}
}
exit (0);
__END__
=head1 NAME
four_tb_check_files.pl - Checks files are on the 4TB box
=head1 SYNOPSIS
[perl] four_tb_check_files.pl [options]
Options:
--help Brief help message
--man Full documentation
=head1 OPTIONS
=over 8
=item B<--man>
The full docs. If you can't see the 'DESCRIPTION' below this right now then this is for you...!
=back
=head1 DESCRIPTION
This script checks the files in the NAS are in the 4TB box. If not it tries to copy them.