| Lines 28-33
          BEGIN {
      
      
        Link Here | 
        
          | 28 | use C4::Letters; | 28 | use C4::Letters; | 
        
          | 29 | use C4::Log; | 29 | use C4::Log; | 
        
          | 30 | use Getopt::Long; | 30 | use Getopt::Long; | 
            
              |  |  | 31 | use MIME::Lite; | 
            
              | 32 | use Mail::Sendmail; | 
            
              | 33 | use Encode; | 
            
              | 34 |  | 
            
              | 35 | use Fcntl ':flock'; | 
        
          | 31 |  | 36 |  | 
        
          | 32 | my $username = undef; | 37 | my $username = undef; | 
        
          | 33 | my $password = undef; | 38 | my $password = undef; | 
  
    | Lines 68-73
          die $usage if $help;
      
      
        Link Here | 
        
          | 68 |  | 73 |  | 
        
          | 69 | cronlogaction(); | 74 | cronlogaction(); | 
        
          | 70 |  | 75 |  | 
            
              |  |  | 76 | print "start of program\n"; | 
            
              | 77 |  | 
            
              | 78 | my $file = "/tmp/messagequeue.lock"; | 
            
              | 79 | open(FOO, ">> $file") or die "Cannot write to $file: $!"; | 
            
              | 80 | print "Getting the lock\n"; | 
            
              | 81 |  | 
            
              | 82 | unless (flock ( FOO, LOCK_EX|LOCK_NB )) { | 
            
              | 83 |     print "$0 is already running. Exiting.\n"; | 
            
              | 84 |  | 
            
              | 85 |     #Send email to inform administrator another process_message_queue.pl cron was attempted to run whilst previous execution of the file is taking place.  | 
            
              | 86 |     # Configure accordingly | 
            
              | 87 |     my $email = MIME::Lite->build( | 
            
              | 88 |                 To => ' ', | 
            
              | 89 |                 From => ' ', | 
            
              | 90 |                 Type => 'TEXT', | 
            
              | 91 |                 Subject => 'process_message_queue.pl cron is already running', | 
            
              | 92 |                 Data => 'process_message_queue.pl cron is already running', | 
            
              | 93 |                 contenttype => 'charset="UTF-8"', | 
            
              | 94 |     ); | 
            
              | 95 |     $email->send('smpt', ' '); | 
            
              | 96 |     exit(1); | 
            
              | 97 | } | 
            
              | 98 |  | 
        
          | 71 | C4::Letters::SendQueuedMessages( | 99 | C4::Letters::SendQueuedMessages( | 
        
          | 72 |     { | 100 |     { | 
        
          | 73 |         verbose  => $verbose, | 101 |         verbose  => $verbose, | 
  
    | Lines 79-81
          C4::Letters::SendQueuedMessages(
      
      
        Link Here | 
        
          | 79 |     } | 107 |     } | 
        
          | 80 | ); | 108 | ); | 
        
          | 81 |  | 109 |  | 
          
            
              | 82 | -  | 110 | print "sleeping 15..\n"; | 
            
              |  |  | 111 | sleep(15); | 
            
              | 112 | print "End of process_message_queue.pl cron process"; |