IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3211


Ignore:
Timestamp:
Feb 13, 2005, 6:49:20 PM (21 years ago)
Author:
eugene
Message:

pcontrol dev

Location:
trunk/Ohana/src/opihi
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/Makefile

    r3187 r3211  
    1212sched: lib.data lib.shell cmd.basic cmd.data cmd.astro
    1313pclient: lib.data lib.shell cmd.basic
     14pcontrol: lib.data lib.shell cmd.basic
    1415
    1516LIBS = cmd.basic cmd.data cmd.astro lib.data lib.shell
     
    1718PROGRAM = mana dvo
    1819
    19 EXTRAS = dvo2 sched dimm pclient
     20EXTRAS = dvo2 sched dimm pclient pcontrol
    2021
    2122all:
  • trunk/Ohana/src/opihi/include/pclient.h

    r3187 r3211  
    7474int CheckChild ();
    7575void CheckChildStatus ();
     76
     77# define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec))
  • trunk/Ohana/src/opihi/lib.shell/opihi.c

    r2800 r3211  
    66  int i, Nbad, Nlist, status;
    77  char **list, *line, *outline, *prompt, *history;
     8  pid_t ppid;
    89
    910  initialize (argc, argv);
     
    1920    line = readline (prompt);
    2021    if (line == NULL) {
     22     
     23      ppid = getppid();
     24      if (ppid == 1) {
     25        fprintf (stderr, "caught parent shutdown\n");
     26        exit (2);
     27      }
    2128      if (!isatty (STDIN_FILENO)) exit (2);
    2229      fprintf (stdout, "Use \"quit\" to exit\n");
  • trunk/Ohana/src/opihi/pclient/ChildOps.c

    r3187 r3211  
    11# include "pclient.h"
     2
     3static int Nbad = 0;
     4static struct timeval last = {0, 0};
    25
    36int InitChild () {
     
    2225
    2326  int Nread;
     27  pid_t ppid;
     28  double dtime;
     29  struct timeval now;
     30
     31  /* this is really lame : check if we are calling too quickly */
     32  gettimeofday (&now, NULL);
     33  dtime = DTIME (now, last);
     34  last = now;
     35  if (dtime < 0.0001) Nbad ++;
     36  if (dtime > 0.01) Nbad = 0;
     37  if (Nbad > 10) {
     38    fprintf (stderr, "parent shutdown\n");
     39    exit (2);
     40  } 
     41
     42  /* this is a bit lame : we must exit if calling process exits */
     43  ppid = getppid();
     44  if (ppid == 1) {
     45    fprintf (stderr, "parent shutdown\n");
     46    exit (2);
     47  } 
    2448
    2549  CheckChildStatus ();
  • trunk/Ohana/src/opihi/pclient/pclient.c

    r3187 r3211  
    1313  fprintf (stderr, "\n");
    1414  fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
     15}
     16
     17void gotsignal (int signum) {
     18  fprintf (stderr, "got signal : %d\n", signum);
     19  return;
    1520}
    1621
     
    5358  /* ignore the history file.  to change this, see, eg, mana.c */
    5459  signal (SIGINT, SIG_IGN);
     60  signal (SIGPIPE, gotsignal);
     61  signal (SIGTSTP, gotsignal);
     62  signal (SIGTTIN, gotsignal);
    5563  return;
    5664}
  • trunk/Ohana/src/opihi/pcontrol/CheckHost.c

    r3203 r3211  
    3939
    4040    default:
    41       fprintf (stderr, "host %s is alive\n", host[0].hostname);
     41      /* fprintf (stderr, "host %s is alive\n", host[0].hostname); */
    4242      PutHost (host, host[0].stack, STACK_BOTTOM);
    4343      FreeIOBuffer (&buffer);
  • trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c

    r3203 r3211  
    1313    job = (Job *) stack[0].object[i];
    1414    if (job[0].mode != PCONTROL_JOB_NEEDHOST) continue;
     15    if (job[0].hostname == NULL) continue;
    1516    if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
    1617    LinkJobAndHost (job, host);
     
    2324    job = (Job *) stack[0].object[i];
    2425    if (job[0].mode != PCONTROL_JOB_WANTHOST) continue;
     26    if (job[0].hostname == NULL) continue;
    2527    if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
    2628    LinkJobAndHost (job, host);
     
    3335    job = (Job *) stack[0].object[i];
    3436    if (job[0].mode != PCONTROL_JOB_ANYHOST) continue;
    35     if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
    3637    LinkJobAndHost (job, host);
    3738    StartJob (job);
  • trunk/Ohana/src/opihi/pcontrol/StartHost.c

    r3204 r3211  
    99  /* pid = rconnect (CONNECT, host[0].hostname, PCLIENT, stdio); */
    1010
    11   strcpy (command, "ssh");
    12   strcpy (shell, "pclient");
     11  if (VarConfig ("COMMAND", "%s", command) == NULL) strcpy (command, "ssh");
     12  if (VarConfig ("SHELL", "%s", shell)     == NULL) strcpy (shell, "pclient");
    1313
    1414  pid = rconnect (command, host[0].hostname, shell, stdio);
  • trunk/Ohana/src/opihi/pcontrol/pclient.c

    r3203 r3211  
    99  int status;
    1010  char *line;
    11  
     11
    1212  /* send command to client (adding on \n) */
     13  fprintf (stderr, "send: %s (%d)\n", command, buffer[0].Nbuffer);
    1314  ALLOCATE (line, char, MAX (1, strlen(command)));
    1415  sprintf (line, "%s\n", command);
     
    2829  if (status ==  0) return (PCLIENT_DOWN);
    2930  if (status == -1) return (PCLIENT_HUNG);
     31  fprintf (stderr, "buffer.buffer: %s\n", buffer[0].buffer);
    3032  return (PCLIENT_GOOD);
    3133}
  • trunk/Ohana/src/opihi/pcontrol/rconnect.c

    r3204 r3211  
    2727  argv[2] = shell;
    2828  argv[3] = 0;
     29  fprintf (stderr, "%s %s %s\n", argv[0], argv[1], argv[2]);
    2930
    3031  pid = fork ();
Note: See TracChangeset for help on using the changeset viewer.