IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2006, 2:13:41 PM (20 years ago)
Author:
eugene
Message:

adding stdout, stderr task commands

Location:
trunk/Ohana/src/opihi/pantasks
Files:
1 added
7 edited

Legend:

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

    r8129 r9037  
    33int CheckJobs () {
    44
     5  FILE *f;
    56  Job *job;
    67  Macro *macro;
     
    3132        PushNamedQueue ("stdout", job[0].stdout.buffer);
    3233        PushNamedQueue ("stderr", job[0].stderr.buffer);
     34
     35        /* save the stdout and stderr if desired */
     36        if (job[0].stdout_dump != NULL) {
     37          f = fopen (job[0].stdout_dump, "a");
     38          if (f == NULL) {
     39            gprint (GP_ERR, "unable to open stdout dump file %s\n", job[0].stdout_dump);
     40          } else {
     41            fwrite (job[0].stdout.buffer, 1, job[0].stdout.Nbuffer, f);
     42            fclose (f);
     43          }
     44        }
     45        if (job[0].stderr_dump != NULL) {
     46          f = fopen (job[0].stderr_dump, "a");
     47          if (f == NULL) {
     48            gprint (GP_ERR, "unable to open stderr dump file %s\n", job[0].stderr_dump);
     49          } else {
     50            fwrite (job[0].stderr.buffer, 1, job[0].stderr.Nbuffer, f);
     51            fclose (f);
     52          }
     53        }
    3354
    3455        /* set taskarg variables */
  • trunk/Ohana/src/opihi/pantasks/JobOps.c

    r8129 r9037  
    121121  InitIOBuffer (&job[0].stderr, 0x100);
    122122
     123  job[0].stdout_dump = NULL;
     124  job[0].stderr_dump = NULL;
     125  if (task[0].stdout_dump != NULL) job[0].stdout_dump = strcreate (task[0].stdout_dump);
     126  if (task[0].stderr_dump != NULL) job[0].stderr_dump = strcreate (task[0].stderr_dump);
     127
    123128  jobs[Njobs] = job;
    124129  Njobs ++;
     
    148153  free (job[0].optv);
    149154
     155  if (job[0].stdout_dump != NULL) free (job[0].stdout_dump);
     156  if (job[0].stderr_dump != NULL) free (job[0].stderr_dump);
     157
    150158  FreeIOBuffer (&job[0].stdout);
    151159  FreeIOBuffer (&job[0].stderr);
  • trunk/Ohana/src/opihi/pantasks/Makefile

    r8548 r9037  
    6262$(SDIR)/task_macros.$(ARCH).o \
    6363$(SDIR)/task_trange.$(ARCH).o \
     64$(SDIR)/task_stdout.$(ARCH).o \
    6465$(SDIR)/task_periods.$(ARCH).o \
    6566$(SDIR)/task_command.$(ARCH).o \
  • trunk/Ohana/src/opihi/pantasks/TaskOps.c

    r8548 r9037  
    282282  NewTask[0].optv = NULL;
    283283
     284  NewTask[0].stdout_dump = NULL;
     285  NewTask[0].stderr_dump = NULL;
     286
    284287  NewTask[0].exec = NULL;
    285288  NewTask[0].crash = NULL;
     
    417420  if (!strcasecmp (command, "NMAX"))      hash = TASK_NMAX;
    418421  if (!strcasecmp (command, "TRANGE"))    hash = TASK_TRANGE;
     422  if (!strcasecmp (command, "STDOUT"))    hash = TASK_STDOUT;
     423  if (!strcasecmp (command, "STDERR"))    hash = TASK_STDERR;
    419424  if (!strcasecmp (command, "COMMAND"))   hash = TASK_COMMAND;
    420425  if (!strcasecmp (command, "OPTIONS"))   hash = TASK_OPTIONS;
  • trunk/Ohana/src/opihi/pantasks/init.c

    r8129 r9037  
    1010int task_options    PROTO((int, char **));
    1111int task_periods    PROTO((int, char **));
     12int task_stdout     PROTO((int, char **));
     13int task_stderr     PROTO((int, char **));
    1214int run             PROTO((int, char **));
    1315int stop            PROTO((int, char **));
     
    3032  {"options",    task_options, "define optional variables associated with the job task"},
    3133  {"periods",    task_periods, "define time scales for a task"},
     34  {"stdout",     task_stdout,  "define a file for the job stdout dump"},
     35  {"stderr",     task_stderr,  "define a file for the job stderr dump"},
    3236  {"run",        run,          "run the scheduler"},
    3337  {"stop",       stop,         "stop the scheduler"},
  • trunk/Ohana/src/opihi/pantasks/scheduler.c

    r7917 r9037  
    3030  InitBasic ();
    3131  InitData ();
    32   InitOutfile ();
    3332  InitSched ();
    3433  InitTasks ();
  • trunk/Ohana/src/opihi/pantasks/task.c

    r8192 r9037  
    9191      case TASK_EXIT:
    9292      case TASK_EXEC:
     93      case TASK_STDOUT:
     94      case TASK_STDERR:
    9395      case TASK_COMMAND:
    9496      case TASK_OPTIONS:
Note: See TracChangeset for help on using the changeset viewer.