X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcluster.pl;h=86785a9777c45c8ae0a4284ec1a0b86c9b84d3da;hb=c94ff1bf2cbe16ed59c5b273c7f6730fd7314cab;hp=e64f558691c76ad1b18d8ed62863dca478dfbdd2;hpb=4b49fe47b37249d748f0a52fe2a778d4bc27232f;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index e64f5586..86785a97 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -10,6 +10,8 @@ # # +package main; + require 5.10.1; use warnings; @@ -29,12 +31,13 @@ BEGIN { die "$root/local doesn't exist, please RTFM" unless -d "$root/local"; die "$root/local/DXVars.pm doesn't exist, please RTFM" unless -e "$root/local/DXVars.pm"; - mkdir "$root/local_cmd", 0777 unless -d "$root/local_cmd"; - + # create some directories + mkdir "$root/local_cmd", 02777 unless -d "$root/local_cmd"; + mkdir "$root/local_data", 02777 unless -d "$root/local_data"; # try to create and lock a lockfile (this isn't atomic but # should do for now - $lockfn = "$root/local/cluster.lck"; # lock file name + $lockfn = "$root/local_data/cluster.lck"; # lock file name if (-w $lockfn) { open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!"; my $pid = ; @@ -56,6 +59,8 @@ BEGIN { use Mojo::IOLoop; use DXVars; +use SysVar; + use Msg; use IntMsg; use Internet; @@ -148,7 +153,6 @@ our $ending; # signal that we are ending; our $broadcast_debug; # allow broadcasting of debug info down "enhanced" user connections - # send a message to call on conn and disconnect sub already_conn { @@ -439,6 +443,7 @@ sub setup_start } STDOUT->autoflush(1); + # try to load the database if (DXSql::init($dsn)) { $dbh = DXSql->new($dsn); @@ -495,15 +500,25 @@ sub setup_start # initialise User file system dbg("loading user file system ..."); - DXUser->init($userfn, 1); + DXUser::init(1); # look for the sysop and the alias user and complain if they aren't there { die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';). Oh and don't forget to rerun create_sysop.pl!" if $mycall eq $myalias; my $ref = DXUser::get($mycall); die "$mycall missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9; + my $oldsort = $ref->sort; + if ($oldsort ne 'S') { + $ref->sort('S'); + dbg "Resetting node type from $oldsort -> DXSpider ('S')"; + } $ref = DXUser::get($myalias); die "$myalias missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9; + $oldsort = $ref->sort; + if ($oldsort ne 'U') { + $ref->sort('U'); + dbg "Resetting sysop user type from $oldsort -> User ('U')"; + } } # start listening for incoming messages/connects