[ic] expireall and server --start fail to run in crontab (was: Where is checkstat.sh?)

Curt Hauge chc@mninter.net
Wed, 28 Mar 2001 11:46:15 -0600


IC 4.6.4 tarball - Construct - Default DB - Linux Mandrake 6.0 - Perl 5.6

I have been after this problem for awhile, and now I am on a different Linux server with a fresh install and the same problem. However, I have now discovered that if I put a copy of interchange.cfg in my "virtual" root (which would be /home/htdocs/my_space), expireall functions as expected!(on this box, not other). Look below at line 103 in expireall. It seems like it is not using the /interchange directory when looking for interchange.cfg - it just looks for interchange.cfg in /my_space. The error logs report nothing.

Here is the scenario.

My crontab looks like this:

5,15,25,35,45,55 * * * * /home/htdocs/my_space/interchange/bin/interchange -serve
1,11,21,31,41,51 * * * * /home/htdocs/my_space/interchange/bin/expireall -r

I am receiving the following error in server mail after cron runs expireall:

Couldn't read interchange.cfg: No such file or directory


It appears to come from line 103 in interchange/bin/expireall:

open(GLOBAL, "< $Global::ConfigFile") or die "Couldn't read $Global::ConfigFile: $!\n";

What is going on in this line to cause it to die? Perhaps it is when it starts up and configures the variables? This is my second installation of Interchange with this problem. The Minivend installations I have done on the same server did not have this problem. Should I report it as a bug? Anyone know where I can go from here?

Thanks again!

Curt Hauge


The whole expireall script follows:

#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
##!~_~perlpath~_~
#
# Interchange session expiration for all catalogs
#
# $Id: expireall.PL,v 1.8 2000/09/25 16:57:54 zarko Exp $
#
# Copyright (C) 1996-2000 Akopia, Inc. <info@akopia.com>
#
# See the file 'Changes' for information.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA  02111-1307  USA.

use lib '/home/htdocs/mnwebdesign/interchange/lib';
#use lib '~_~INSTALLPRIVLIB~_~';
use lib '/home/htdocs/mnwebdesign/interchange';
#use lib '~_~INSTALLARCHLIB~_~';

use strict;
use Getopt::Std;
use vars qw/$opt_e $opt_f $opt_n $opt_r/; 


BEGIN {
	($Global::VendRoot = $ENV{MINIVEND_ROOT})
		if defined $ENV{MINIVEND_ROOT};

	$Global::VendRoot = $Global::VendRoot || '/home/htdocs/mnwebdesign/interchange';
#	$Global::VendRoot = $Global::VendRoot || '~_~INSTALLARCHLIB~_~';

	if(-f "$Global::VendRoot/interchange.cfg") {
		$Global::ExeName = 'interchange';
		$Global::ConfigFile = 'interchange.cfg';
	}
	elsif(-f "$Global::VendRoot/minivend.cfg") {
		$Global::ExeName = 'minivend';
		$Global::ConfigFile = 'minivend.cfg';
	}
	elsif(-f "$Global::VendRoot/interchange.cfg.dist") {
		$Global::ExeName = 'interchange';
		$Global::ConfigFile = 'interchange.cfg';
	}
}

### END CONFIGURATION VARIABLES

my $prog = $0;
$prog =~ s:.*/::;

my $USAGE = <<EOF;
usage: $prog [-r] [-f file]

	-f    Alternate interchange.cfg file
	-r    Use reorganize parameter in command

Expire all listed Interchange catalogs. Will read information from
either the file passed with -f or:

	$Global::VendRoot/interchange.cfg

EOF

getopts('e:f:rn') or die "$@\n$USAGE\n";

($Global::ConfigFile = $opt_f)
	if defined $opt_f;

my $flag = '';
my @cats;

if ($opt_r) {
	$flag .= '-r';
}

if($opt_e) {
	$flag .= qq{ -e "$opt_e"};
}

unless ($opt_n) {
	$flag .= " -u";
}

# Parse the interchange.cfg file to look for script/catalog info
PARSECFG: {
	my(@cfglines,%seen);

	open(GLOBAL, "< $Global::ConfigFile") or die "Couldn't read $Global::ConfigFile: $!\n";
	while(<GLOBAL>) {
		push(@cfglines, $_) if /^\s*catalog\s+/i;
	}
	close GLOBAL;

	@cfglines = grep !$seen{$_}++, @cfglines;

	for(@cfglines) {
		next unless /^\s*(?:sub)?catalog\s+([-\w_]+)/i;
		push(@cats, $1);
	}

}

for(@cats) {
	system "$Global::VendRoot/bin/expire $flag -c $_";
}

=head1 NAME

expireall -- Run Interchange expire on all catalogs

=head1 VERSION

$Id: expireall.PL,v 1.8 2000/09/25 16:57:54 zarko Exp $

=head1 DESCRIPTION

Skeleton POD to avoid make errors.

=head1 SEE ALSO

mvdocs(8), expire(1), http://www.akopia.com/


=cut