X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcreate_sysop.pl;h=246de92d1a39fd9ee4df8d999ff9cc7a247feb07;hb=eb944656dcd2b715338ea025fbad11e918506e26;hp=fbeca2727ef34bc923a34d549b790a2bf7857954;hpb=fa18779239db0812846a1bb383359d7eab272697;p=spider.git diff --git a/perl/create_sysop.pl b/perl/create_sysop.pl index fbeca272..246de92d 100755 --- a/perl/create_sysop.pl +++ b/perl/create_sysop.pl @@ -23,7 +23,7 @@ use DXUser; sub delete_it { - system("rm -f $userfn*"); + DXUser->del_file($userfn); } sub create_it @@ -37,11 +37,11 @@ sub create_it $self->{qth} = $myqth; $self->{qra} = $mylocator; $self->{lat} = $mylatitude; - $self->{long} = $mylongtitude; + $self->{long} = $mylongitude; $self->{email} = $myemail; $self->{bbsaddr} = $mybbsaddr; $self->{homenode} = $mycall; - $self->{sort} = 'A'; # C - Console user, S - Spider cluster, A - AK1A, U - User, B - BBS + $self->{sort} = 'S'; # C - Console user, S - Spider cluster, A - AK1A, U - User, B - BBS $self->{priv} = 9; # 0 - 9 - with 9 being the highest $self->{lastin} = 0; $self->{dxok} = 1; @@ -59,7 +59,7 @@ sub create_it $self->{qth} = $myqth; $self->{qra} = $mylocator; $self->{lat} = $mylatitude; - $self->{long} = $mylongtitude; + $self->{long} = $mylongitude; $self->{email} = $myemail; $self->{bbsaddr} = $mybbsaddr; $self->{homenode} = $mycall; @@ -75,20 +75,33 @@ sub create_it } -DXUser->init($userfn); +$lockfn = "$root/perl/cluster.lck"; # lock file name +if (-e $lockfn) { + open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!"; + my $pid = ; + chomp $pid; + die "Sorry, Lockfile ($lockfn) and process $pid exist, a cluster is running\n" if kill 0, $pid; + close CLLOCK; +} + if (-e "$userfn") { print "Do you wish to destroy your user database (THINK!!!) [y/N]: "; $ans = ; if ($ans =~ /^[Yy]/) { delete_it(); + DXUser->init($userfn, 1); create_it(); } else { print "Do you wish to reset your cluster and sysop information? [y/N]: "; $ans = ; - create_it() if $ans =~ /^[Yy]/; + if ($ans =~ /^[Yy]/) { + DXUser->init($userfn, 1); + create_it(); + } } } else { + DXUser->init($userfn, 1); create_it(); } DXUser->finish();