IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 13, 2006, 8:55:19 AM (20 years ago)
Author:
eugene
Message:

added active state to tasks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/controller_run.c

    r8548 r10694  
    77  IOBuffer buffer;
    88
    9   if (argc != 1) {
    10     gprint (GP_ERR, "USAGE: controller run\n");
     9  if ((argc > 2) ||
     10      get_argument (argc, argv, "help") ||
     11      get_argument (argc, argv, "-h") ||
     12      get_argument (argc, argv, "--help"))
     13  {
     14    if (!strcmp (argv[0], "run")) {
     15      gprint (GP_ERR, "USAGE: controller run [level]\n");
     16      gprint (GP_ERR, "  allowed levels:\n");
     17      gprint (GP_ERR, "  all (default) : manage machines, spawn jobs, harvest jobs\n");
     18      gprint (GP_ERR, "  reap          : manage machines, harvest jobs\n");
     19      gprint (GP_ERR, "  hosts         : manage machines, not jobs\n");
     20      gprint (GP_ERR, "  none          : all stop\n");
     21    } else {
     22      gprint (GP_ERR, "USAGE: controller stop (immediate processing halt)\n");
     23    }
    1124    return (FALSE);
    1225  }
     
    1932  }
    2033
    21   sprintf (command, "run");
     34  if (argc == 1) {
     35    strcpy (command, argv[0]);
     36  } else {
     37    sprintf (command, "run %s", argv[1]);
     38  }
     39
    2240  InitIOBuffer (&buffer, 0x100);
    2341  status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
     
    3048  return (TRUE);
    3149}
    32 
    33 int controller_stop (int argc, char **argv) {
    34 
    35   int status;
    36   char command[1024];
    37   IOBuffer buffer;
    38 
    39   if (argc != 1) {
    40     gprint (GP_ERR, "USAGE: controller stop\n");
    41     return (FALSE);
    42   }
    43 
    44   /* check if controller is running */
    45   status = CheckControllerStatus ();
    46   if (!status) {
    47     gprint (GP_LOG, "controller is not active\n");
    48     return (TRUE);
    49   }
    50 
    51   sprintf (command, "stop");
    52   InitIOBuffer (&buffer, 0x100);
    53   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
    54   if (status) {
    55     gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
    56   } else {
    57     gprint (GP_LOG, "controller is not responding\n");
    58   }
    59   FreeIOBuffer (&buffer);
    60   return (TRUE);
    61 }
Note: See TracChangeset for help on using the changeset viewer.