Subversion Repositories sysadmin_scripts

Rev

Rev 53 | Rev 55 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 53 Rev 54
Line 17... Line 17...
17
#           Config is now YAML
17
#           Config is now YAML
18
#           Default section which will fill in the blanks for anything not filled in on an account, so creating a lot of accounts
18
#           Default section which will fill in the blanks for anything not filled in on an account, so creating a lot of accounts
19
#              with common values is easier to set up an maintain
19
#              with common values is easier to set up an maintain
20
#           Target folder is configurable on a per account basis, using tags <folder>, <year>, <month> (called hierachy)
20
#           Target folder is configurable on a per account basis, using tags <folder>, <year>, <month> (called hierachy)
21
#
21
#
-
 
22
#    version 2.1.0 20190822 RWR
-
 
23
#           Added sleeptime parameter to target which makes process sleep a number of seconds between each mail transfer
-
 
24
#              We use HiRes, so this can be a decimal number (ie, 0.5 for half a second).
-
 
25
#
-
 
26
#
22
#    This program is free software: you can redistribute it and/or modify
27
#    This program is free software: you can redistribute it and/or modify
23
#    it under the terms of the GNU General Public License as published by
28
#    it under the terms of the GNU General Public License as published by
24
#    the Free Software Foundation, either version 3 of the License, or
29
#    the Free Software Foundation, either version 3 of the License, or
25
#    (at your option) any later version.
30
#    (at your option) any later version.
26
#
31
#
Line 43... Line 48...
43
use Clone 'clone'; # libclone-perl
48
use Clone 'clone'; # libclone-perl
44
use Hash::Merge::Simple qw/ merge clone_merge /; # libhash-merge-simple-perl
49
use Hash::Merge::Simple qw/ merge clone_merge /; # libhash-merge-simple-perl
45
use Date::Manip; # libdate-manip-perl
50
use Date::Manip; # libdate-manip-perl
46
use Email::Simple; # libemail-simple-perl
51
use Email::Simple; # libemail-simple-perl
47
use Date::Parse;
52
use Date::Parse;
-
 
53
use Time::HiRes;
48
 
54
 
49
 
55
 
50
use Data::Dumper;
56
use Data::Dumper;
51
 
57
 
52
# globals
58
# globals
Line 64... Line 70...
64
                  # 'username' => 'username',
70
                  # 'username' => 'username',
65
                  # hierarchy can be any combination of <path>, <month> and <year>
71
                  # hierarchy can be any combination of <path>, <month> and <year>
66
                  'hierarchy' => '<path>',
72
                  'hierarchy' => '<path>',
67
                  # default target server
73
                  # default target server
68
                  'server' => 'localhost',
74
                  'server' => 'localhost',
-
 
75
                  # amount of time to sleep between messages, in seconds (float)
-
 
76
                  'sleeptime' => 0.5,
69
                 },
77
                 },
70
      # where the mail is coming from
78
      # where the mail is coming from
71
      'source' => {
79
      'source' => {
72
                  # these have no defaults. They should be in the configuration file
80
                  # these have no defaults. They should be in the configuration file
73
                  # 'password' => 'password',
81
                  # 'password' => 'password',
Line 261... Line 269...
261
         next;
269
         next;
262
      }
270
      }
263
      if ( $target->{'connection'}->select( $targetFolder ) || &makeFolder( $target->{'connection'}, $targetFolder, $target->{'separator'} ) ) {
271
      if ( $target->{'connection'}->select( $targetFolder ) || &makeFolder( $target->{'connection'}, $targetFolder, $target->{'separator'} ) ) {
264
         if ( $target->{'connection'}->put( $targetFolder, $message, @flags ) ) {
272
         if ( $target->{'connection'}->put( $targetFolder, $message, @flags ) ) {
265
            $source->{'connection'}->delete( $id ) if ( $source->{'deleteOnSuccess'} ) ;
273
            $source->{'connection'}->delete( $id ) if ( $source->{'deleteOnSuccess'} ) ;
-
 
274
            Time::HiRes::sleep( $target->{'sleeptime'} ) if $target->{'sleeptime'};
266
            $numMessages++;
275
            $numMessages++;
267
         } else {
276
         } else {
268
            die "Could not write to target, aborting\n$targetFolder->{'connection'}->errstr\n";
277
            die "Could not write to target, aborting\n$targetFolder->{'connection'}->errstr\n";
269
         }
278
         }
270
      } else {
279
      } else {