IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2012, 6:50:18 AM (14 years ago)
Author:
eugene
Message:

added some notes to dvosplit; working on dvodist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/HostTableLoad.c

    r33203 r33204  
    11# include "photdbc.h"
     2# define DEBUG 1
    23
    34typedef struct {
     
    4849  InitHosts (hosts, Nhosts, NHOSTS);
    4950
     51  int maxID = 0;
     52
    5053  int Nline;
    5154  for (Nline = 0; TRUE; Nline ++) {
     
    6972    }
    7073
     74    // check the validity of ID (0 < ID < MAX_SHORT)
     75
     76    if (ID < 1) {
     77      fprint (stderr, "invalid host ID %d\n", ID);
     78      exit (1);
     79    }
     80    if (ID > 65535) {
     81      fprint (stderr, "invalid host ID %d\n", ID);
     82      exit (1);
     83    }
     84    maxID = MAX(maxID, ID);
     85
    7186    hosts[Nhosts].hostID = ID;
    7287    hosts[Nhosts].hostname = strcreate(tmphost);
     
    85100  table->hosts = hosts;
    86101
     102  ALLOCATE (table->index, unsigned short, maxID + 1);
     103  for (i = 0; i <= maxID; i++) table->index[i] = -1;
     104
     105  for (i = 0; i < table->Nhosts; i++) {
     106    if (table->index[table->hosts[i].hostID] == -1) {
     107      fprintf (stderr, "error: duplicate hostID %d\n", table->hosts[i].hostID);
     108      exit (1);
     109    }
     110    table->index[table->hosts[i].hostID] = i;
     111  }
     112
    87113  return table;
    88114}
     
    90116int CheckHostsAndPaths (HostTable *table) {
    91117
     118  int i;
     119  int stdio[3];
    92120  char command[64];
    93121  char shell[64];
    94122
    95123  strcpy (command, "ssh");
    96   strcpy (shell, "pclient");
     124  strcpy (shell, "csh");
    97125
    98126  for (i = 0; i < table->Nhosts; i++) {
     
    101129    if (DEBUG) fprintf (stderr, "starting host within thread\n");
    102130
    103     pid = rconnect (command, host[0].hostname, shell, stdio);
     131    pid = rconnect (command, table->hosts[i].hostname, shell, stdio);
    104132    if (!pid) {     
    105133      /** failure to start: extend retry period **/
    106134      if (DEBUG) fprintf (stderr, "failure to start %s\n", table->hosts[i].hostname);
     135      exit (1);
    107136    }
     137
     138    // XXX check anything else?
     139
     140    // close the connection
     141    close(stdio[0]);
     142    close(stdio[1]);
     143    close(stdio[2]);
     144
     145    status = check_dir_access (table->hosts[i].pathname, DEBUG);
     146    if (!status) {
     147      fprintf (stderr, "failed to find / create target path\n");
     148      exit (2);
     149    }
     150
     151    fprintf (stderr, "success : %s, %s\n", table->hosts[i].hostname, table->hosts[i].pathname);
    108152  }
    109 
     153  return (TRUE);
    110154}
Note: See TracChangeset for help on using the changeset viewer.