projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
alter is_callsign checks
[spider.git]
/
perl
/
cluster.pl
diff --git
a/perl/cluster.pl
b/perl/cluster.pl
index fc530e21c1db11b12f554ab43514f33a8e1f01fa..d82dd2e73bbd8d67aa68538a39dd19e49f6ae00e 100755
(executable)
--- a/
perl/cluster.pl
+++ b/
perl/cluster.pl
@@
-10,6
+10,8
@@
#
#
#
#
+package main;
+
require 5.10.1;
use warnings;
require 5.10.1;
use warnings;
@@
-29,18
+31,22
@@
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";
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
# 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 = <CLLOCK>;
if ($pid) {
chomp $pid;
if (-w $lockfn) {
open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
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;
}
unlink $lockfn;
close CLLOCK;
@@
-53,9
+59,12
@@
BEGIN {
$systime = time;
}
$systime = time;
}
+
use Mojo::IOLoop;
use DXVars;
use Mojo::IOLoop;
use DXVars;
+use SysVar;
+
use Msg;
use IntMsg;
use Internet;
use Msg;
use IntMsg;
use Internet;
@@
-148,7
+157,6
@@
our $ending; # signal that we are ending;
our $broadcast_debug; # allow broadcasting of debug info down "enhanced" user connections
our $broadcast_debug; # allow broadcasting of debug info down "enhanced" user connections
-
# send a message to call on conn and disconnect
sub already_conn
{
# send a message to call on conn and disconnect
sub already_conn
{
@@
-439,6
+447,7
@@
sub setup_start
}
STDOUT->autoflush(1);
}
STDOUT->autoflush(1);
+
# try to load the database
if (DXSql::init($dsn)) {
$dbh = DXSql->new($dsn);
# try to load the database
if (DXSql::init($dsn)) {
$dbh = DXSql->new($dsn);
@@
-495,7
+504,7
@@
sub setup_start
# initialise User file system
dbg("loading user file system ...");
# 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
{
# look for the sysop and the alias user and complain if they aren't there
{