1. Make cluster.lck checking consistent and accurate.
2. Fix export_user actions to always put them in local_data.
3. Fix create_prefix.pl output file and input file searching. Basically
this now looks for cty.dat and wpxloc.raw in local_data first and then
falls backs to data. But puts the result in local_data unless the
--system flag is set.
#
#
my $self = shift;
-my $line = shift || localdata("user_asc");
+my $line = shift || "user_asc";
return (1, $self->msg('e5')) unless $self->priv >= 9;
my ($fn, $flag) = split /\s+/, $line;
sub export
{
- my $fn = shift;
+ my $name = shift;
my $basic_info_only = shift;
+
+ my $fn = "$main::local_data/$name";
# save old ones
- rename "$fn.oooo", "$fn.ooooo" if -e "$fn.oooo";
- rename "$fn.ooo", "$fn.oooo" if -e "$fn.ooo";
- rename "$fn.oo", "$fn.ooo" if -e "$fn.oo";
- rename "$fn.o", "$fn.oo" if -e "$fn.o";
- rename "$fn", "$fn.o" if -e "$fn";
+ move "$fn.oooo", "$fn.ooooo" if -e "$fn.oooo";
+ move "$fn.ooo", "$fn.oooo" if -e "$fn.ooo";
+ move "$fn.oo", "$fn.ooo" if -e "$fn.oo";
+ move "$fn.o", "$fn.oo" if -e "$fn.o";
+ move "$fn", "$fn.o" if -e "$fn";
my $count = 0;
my $err = 0;
my $pid = <CLLOCK>;
if ($pid) {
chomp $pid;
- die "Lockfile ($lockfn) and process $pid exist, another cluster running?" if kill 0, $pid;
+ if (kill 0, $pid) {
+ warn "Lockfile ($lockfn) and process $pid exist, another cluster running?\n";
+ exit 1;
+ }
}
unlink $lockfn;
close CLLOCK;
$systime = time;
}
+
use Mojo::IOLoop;
use DXVars;
unshift @INC, "$root/local";
}
+use DXVars;
use SysVar;
use Data::Dumper;
my %pre = (); # the prefix hash
my %pren = (); # the inverse
-if (@ARGV && $ARVG[0] =~ /^--system$/) {
+my $prefix;
+
+if (@ARGV && $ARGV[0] =~ /^--system$/) {
$prefix = $main::data;
shift;
} else {
- $prefix = $main:local_data;
+ $prefix = $main::local_data;
}
-# open the input file
-my $ifn = $ARGV[0] if $ARGV[0];
+my $ifn;
-$ifn = "$prefix/wpxloc.raw" if !$ifn;
-open (IN, $ifn) or die "can't open $ifn ($!)";
+$ifn = "$prefix/wpxloc.raw";
+unless (open (IN, $ifn)) {
+ $ifn = "$main::data/wpxloc.raw";
+ open(IN, $ifn) or die "can't open $ifn ($!)";
+}
# first pass, find all the 'master' location records
while (<IN>) {
#print Data::Dumper->Dump([\%pre, \%locn], [qw(pre locn)]);
# now open the cty.dat file if it is there
+my $r;
+$ifn = "$prefix/cty.dat";
+unless ($r = open (IN, $ifn)) {
+ $ifn = "$main::data/cty.dat";
+ $r = open(IN, $ifn);
+}
+
my @f;
my @a;
$line = 0;
-if (open(IN, "$prefix/cty.dat")) {
+if ($r) {
my $state = 0;
while (<IN>) {
$line++;
die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';).\n" if $mycall eq $myalias;
-$lockfn = localdata("cluster.lck"); # lock file name
+$lockfn = "$main::local_data/cluster.lck"; # lock file name (now in local data)
if (-e $lockfn) {
open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
my $pid = <CLLOCK>;
# root of directory tree for this system
$root = "/spider";
$root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
- unshift @INC, "$root/perl"; # this IS the right way round!
+ unshift @INC, "$root/perl"; # this IS the right way round!
unshift @INC, "$root/local";
}
use DXUser;
use DXUtil;
-my $lockfn = localdata("cluster.lck"); # lock file name
+$lockfn = "$main::local_data/cluster.lck"; # lock file name (now in local d
if (-e $lockfn) {
open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
my $pid = <CLLOCK>;
die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';).\n" if $mycall eq $myalias;
-$lockfn = localdata("cluster.lck"); # lock file name
+$lockfn = "$main::local_data/cluster.lck"; # lock file name (now in local d
if (-e $lockfn) {
open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
my $pid = <CLLOCK>;