Line 1... |
Line 1... |
1 |
%config = (
|
1 |
%config = (
|
2 |
# location where directories are put by end users
|
2 |
# location where directories are put by end users
|
3 |
'local root dir' => '',
|
3 |
'local root dir' => '/home/dallas_active_projects/ready_to_archive',
|
4 |
# location where directories are moved when job is completed
|
4 |
# location where directories are moved when job is completed
|
5 |
'local trash dir' => '',
|
5 |
'local trash dir' => '/home/archiveDirectories/Trash',
|
6 |
# location where directories are moved while being transferred
|
6 |
# location where directories are moved while being transferred
|
7 |
'local staging area' => '',
|
7 |
'local staging area' => '/home/archiveDirectories/Staging',
|
8 |
|
8 |
|
9 |
# target server name/ip. Must be accessible via ssh with no password
|
9 |
# target server name/ip. Must be accessible via ssh with no password
|
10 |
'target server' => '',
|
10 |
'target server' => 'davinci',
|
11 |
# location on target server where directories are placed while copying
|
11 |
# location on target server where directories are placed while copying
|
12 |
'target staging area' => '',
|
12 |
'target staging area' => '/home/samba/archives/ready_to_archive',
|
13 |
# location on target server where directories are finally put
|
13 |
# location on target server where directories are finally put
|
14 |
'target final directory' => '',
|
14 |
'target final directory' => '/home/samba/archives/MC',
|
15 |
|
15 |
|
16 |
# suffix of md5 of directories
|
16 |
# suffix of md5 of directories
|
17 |
'md5 suffix' => 'md5sum',
|
17 |
'md5 suffix' => 'md5sum',
|
18 |
# suffix of filename to create showing actions
|
18 |
# suffix of filename to create showing actions
|
19 |
'log suffix' => 'log',
|
19 |
'log suffix' => 'log',
|
Line 22... |
Line 22... |
22 |
# how long a directory must be undisturbed before it is ready to work on
|
22 |
# how long a directory must be undisturbed before it is ready to work on
|
23 |
'quiesent seconds' => 60*5, # five minutes
|
23 |
'quiesent seconds' => 60*5, # five minutes
|
24 |
# how long to leave stuff in the trash directory. 0 indicates never do it.
|
24 |
# how long to leave stuff in the trash directory. 0 indicates never do it.
|
25 |
'trash cleanup' => 86400*7, # 7 days
|
25 |
'trash cleanup' => 86400*7, # 7 days
|
26 |
# anoymous subroutine to do any final processing on remote machine
|
26 |
# anoymous subroutine to do any final processing on remote machine
|
27 |
'final procedure' => sub { return 1; }
|
27 |
'final procedure' =>
|
- |
|
28 |
sub {
|
- |
|
29 |
my ( $remoteServer, $remoteStaging, $remoteTarget, $directory ) = @_;
|
- |
|
30 |
my $target = substr( $directory, 0, 2 );
|
- |
|
31 |
$target = "$remoteTarget/MC_Patient_20$target/";
|
- |
|
32 |
my ($message, $error ) = &runRemoteCommand( $remoteServer, "[ ! -d $target ] && mkdir -p $target" );
|
- |
|
33 |
if ( $error == 0 ) {
|
- |
|
34 |
my $command = "mv '$remoteStaging/$directory' '$target'";
|
- |
|
35 |
$command = "ssh $remoteServer " . '"' . $command . '"';
|
- |
|
36 |
my $message = qx/$command/;
|
- |
|
37 |
&logit( $directory, $error == 0 ? $config{ 'log suffix' } : $config{ 'error suffix' }, $message );
|
- |
|
38 |
} else {
|
- |
|
39 |
&logit( $directory, $config{ 'error suffix' }, $message );
|
- |
|
40 |
}
|
- |
|
41 |
} # anonymous sub
|
28 |
);
|
42 |
);
|