Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
16 rodolico 1
%config = (
2
   # location where directories are put by end users   
30 rodolico 3
   'local root dir' => '/home/dallas_active_projects/ready_to_archive',
16 rodolico 4
   # location where directories are moved when job is completed
30 rodolico 5
   'local trash dir' => '/home/archiveDirectories/Trash',
16 rodolico 6
   # location where directories are moved while being transferred
30 rodolico 7
   'local staging area' => '/home/archiveDirectories/Staging',
16 rodolico 8
 
9
   # target server name/ip. Must be accessible via ssh with no password
30 rodolico 10
   'target server' => 'davinci',
16 rodolico 11
   # location on target server where directories are placed while copying
30 rodolico 12
   'target staging area' => '/home/samba/archives/ready_to_archive',
16 rodolico 13
   # location on target server where directories are finally put
30 rodolico 14
   'target final directory' => '/home/samba/archives/MC',
16 rodolico 15
 
16
   # suffix of md5 of directories
17
   'md5 suffix' => 'md5sum',
18
   # suffix of filename to create showing actions
19
   'log suffix' => 'log',
20
   # suffix of error log
21
   'error suffix' => 'err',
22
   # how long a directory must be undisturbed before it is ready to work on
23
   'quiesent seconds' => 60*5, # five minutes
24
   # how long to leave stuff in the trash directory. 0 indicates never do it.
25
   'trash cleanup' => 86400*7, # 7 days
26
   # anoymous subroutine to do any final processing on remote machine
30 rodolico 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
16 rodolico 42
);