use warnings; use strict; use POSIX; use Cwd; use Cwd 'abs_path'; use Time::Local 'timelocal_nocheck'; # used for SCHEDULE option in the MQX.ini use Net::Domain qw(hostname hostfqdn hostdomain domainname); use File::Basename; use File::Copy; use IO::Compress::Gzip qw(gzip $GzipError) ; use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; # module used in the state messages use Digest::MD5; # modules used in put mode use threads; use threads::shared; use Thread::Queue; if ( gzip $archfile => "$archfile.gz", AutoClose => 1, BinModeIn => 1 ) { my $delete_try_counter = mqx_get_setting('ARCHIVEMOVETRY'); while ( -f $archfile and not unlink $archfile and $delete_try_counter != 0 ) { $global_EVENTLOG_IN_LQ->enqueue("WARNING, $arch_hashref->{'EVENTLOG'},Can not delete $archfile. Error: $! try: $delete_try_counter"); $delete_try_counter -= 1; sleep(mqx_get_setting('ARCHIVEMOVEWAIT')); # wait x seconds before retrying } $archfile .= ".gz"; # add .gz to the file name } else { # if the gzip failed try to archive the original file $global_EVENTLOG_IN_LQ->enqueue("ERROR, $arch_hashref->{'EVENTLOG'}, gzip failed on $archfile\n$GzipError"); }