Changeset 26989

Show
Ignore:
Timestamp:
05.03.2013 10:27:01 (7 years ago)
Author:
jmt12
Message:

Hostname is now automatically determined when the script is run - rather than being read in from a config file (which, co-incidently I forgot to update when I moved from Karearea, and spent a while tracking down why TDBServer wasn't starting up properly

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb-edit/trunk/src/bin/script/TDBServer.pl

    r25486 r26989  
    4949  $revision += 0; 
    5050  # - and add to Perl's path 
     51  unshift (@INC, $ENV{'GEXTTDBEDIT_INSTALLED'} . '/lib/perl5/site_perl/' . $major . '.' . $minor . '.' . $revision); 
    5152  unshift (@INC, $ENV{'GEXTTDBEDIT_INSTALLED'} . '/share/perl/' . $major . '.' . $minor . '.' . $revision); 
    5253} 
     
    8283my $collection = ''; 
    8384my $no_daemon = 0; 
    84 my $debug = 0; 
     85my $debug = 1; 
    8586my $server; 
    86 my $server_host; 
     87my $machine_name = `hostname -s`; 
     88chomp($machine_name); 
     89my $server_host = $machine_name . '.local'; 
    8790my $server_port; 
    8891my $server_threads; 
     
    138141      my $key = $1; 
    139142      my $value = $2; 
     143      # Allow the override of serverhost 
    140144      if ($key eq "serverhost") 
    141145      { 
     
    216220  if ($pid == 0) 
    217221  { 
     222    print STDERR "[" . time() . ":" . $server_host . ":" . $server_port . "]\n"; 
     223    print " * Starting server on " . $server_host . ":" . $server_port . "\n"; 
    218224    # - create server object 
    219     print " * Creating pool of " . $server_threads . " threads listening on socket: " . $server_host . ":" . $server_port . "\n"; 
     225    print " * Creating pool of " . $server_threads . " threads listening on socket\n"; 
    220226    $server = SocketsSwimmingThreadPoolServer->new(host=>$server_host, 
    221227                                                   port=>$server_port, 
     
    494500      } 
    495501      &debugPrint($the_count, $tid, $command_name, 'Command: ' . $command1) unless !$debug; 
    496       $result = `$command1`; 
     502      if (-e $tdb_path) 
     503      { 
     504        $result = `$command1`; 
     505      } 
     506      else 
     507      { 
     508        &debugPrint("TDB database doesn't exist (yet): " . $tdb_path); 
     509        $result = ''; 
     510      } 
    497511      &debugPrint($the_count, $tid, $command_name, 'Result: ' . $result) unless !$debug; 
    498       if ($result =~ /-{70}/) 
     512      if ($result !~ /-{70}/) 
    499513      { 
    500514        $result .= "-"x70 . "\n";