sub init
{
### initialize globals every time site_specific configuration chan
+ges
undef(%s) if defined(%s);#clear out the globals if they exist
$s{begin} = time();
$s{log} = $ROOT . $LOGD . "\\$s{begin}" . $LOG;
$s{wrkd} = $ROOT . $WRKD;
$s{work} = "WORK FILE NOT SET";
$s{xfrd} = "XFER DIR NOT SET";
$s{sync} = $SYNC_PATTERN;
my $config_file = $ENV{$ITPS_BIN_ENV}."\\".$CFGF;
open C, "<$config_file"
or die "Cannot open external configuration file, $config_file"
+;
my $pattern = $TARGET_DIR;
while (<C>)
{
chomp;
if ($_ =~ m/$pattern[\s]*=[\s]*([^\s]+)/)
{
$s{xfrd} = $1;
last;
}
}
close C;
die "No valid transfer directory path was given in the configurati
+on file, $config_file\n"
unless (
$s{xfrd} !~ /NOT SET/ # the name of the directory was foun
+d in the config file
&& -e $s{xfrd} # the name identifies a directory th
+at exists
&& -w $s{xfrd} # the directory is writable by this
+process
);
### read command-line arguments
foreach my $p (@ARGV)
{
$s{$p} = TRUE;
}
} #end INIT sub
|