Ejemplo n.º 1
0
int
main (int argc, char **argv)
{
  struct submit req;
  struct submitReply reply;
  char *job;
  LS_LONG_INT jobId = -1, *jobIdList = NULL;
  int numJobIds;
  time_t beginTime, terminTime;
  int rc;

  rc = _i18n_init (I18N_CAT_MIN);

  if (lsb_init (argv[0]) < 0)
    {
      sub_perror ("lsb_init");
      fprintf (stderr, ". %s.\n", (_i18n_msg_get (ls_catd, NL_SETN, 351, "Job not modified")));	/* catgets  351  */
      exit (-1);
    }

  if (fillReq (argc, argv, CMD_BMODIFY, &req) < 0)
    {
      fprintf (stderr, ". %s.\n",
	       (_i18n_msg_get (ls_catd, NL_SETN, 351, "Job not modified")));
      exit (-1);
    }

  job = req.command;
  beginTime = req.beginTime;
  terminTime = req.termTime;

  if ((numJobIds = getJobIdList (job, &jobIdList)) < 0)
    {
      exit (-1);
    }
  jobId = jobIdList[0];
  if ((jobId = lsb_modify (&req, &reply, jobId)) < 0)
    {
      if (lsberrno == LSBE_JOB_ARRAY)
	{
	  fprintf (stderr, (_i18n_msg_get (ls_catd, NL_SETN, 352, "Options -q and -O cannot be applied on job array")));	/* catgets  352  */
	}
      else
	prtErrMsg (&req, &reply);
      fprintf (stderr, ". %s.\n",
	       (_i18n_msg_get (ls_catd, NL_SETN, 351, "Job not modified")));
      if (req.nxf)
	free (req.xf);
      exit (-1);
    }

  printf ((_i18n_msg_get (ls_catd, NL_SETN, 353, "Parameters of job <%s> are being changed\n")), job);	/* catgets  353 */
  if (beginTime > 0 || terminTime > 0)
    prtBETime_ (&req);
  if (req.nxf)
    free (req.xf);

  _i18n_end (ls_catd);
  exit (0);
}
Ejemplo n.º 2
0
int
main(int argc, char **argv)
{
    struct submit req;
    struct submitReply  reply;
    char *job;
    LS_LONG_INT jobId = -1, *jobIdList = NULL;
    int numJobIds;
    time_t beginTime, terminTime;

    if (lsb_init(argv[0]) < 0) {
        sub_perror("lsb_init");
        fprintf(stderr, ". Job not modified.\n");
        exit (-1);
    }

    if (fillReq (argc, argv, CMD_BMODIFY, &req) < 0) {
        fprintf(stderr, ". Job not modified.\n");
        exit (-1);
    }

    job = req.command;
    beginTime = req.beginTime;
    terminTime = req.termTime;

    if ((numJobIds = getJobIdList(job, &jobIdList)) < 0) {
        exit(-1);
    }

    jobId = jobIdList[0];

    if ((jobId = lsb_modify(&req, &reply, jobId)) < 0) {
       if (lsberrno == LSBE_JOB_ARRAY) {
            fprintf(stderr, "Options -q and -O cannot be applied on job array");
       } else {
            prtErrMsg (&req, &reply);
       }
	fprintf(stderr, ". Job not modified.\n");
        if (req.nxf)
            free(req.xf);
        exit (-1);
    }

    printf("Parameters of job <%s> are being changed\n", lsb_jobid2str(jobId));
    if (beginTime > 0 || terminTime > 0)
        prtBETime_(&req);
    if (req.nxf)
        free(req.xf);

    return 0;
}