コード例 #1
0
ファイル: comment.c プロジェクト: CESNET/torque
static int
schd_alterserver(int sv_conn, char *name, char *value)
  {
  char   *id = "schd_alterserver";
  int     err;
  AttrOpList alist;

  /* Fill in the attribute struct with appropriate parameters */

  alist.resource = NULL;
  alist.value    = value;
  alist.name     = name;
  alist.next     = NULL;
  alist.op       = SET;

  err = pbs_manager(sv_conn, MGR_CMD_SET, MGR_OBJ_SERVER, "", &alist,
                    NULL);

  if (err)
    {
    (void)sprintf(log_buffer,
                  "pbs_alterserver(%s, %s) failed: %d", name, value, pbs_errno);
    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);
    }

  return (err);
  }
コード例 #2
0
ファイル: qstop.c プロジェクト: bayucan/pbspro
/**
 * @brief
 *	disables a destination (queue) 
 *
 * @param queue - The name of the queue to disable.
 * @param server - The name of the server that manages the queue.
 *
 * @return - Void
 *
 * @File Variables:
 * exitstatus  Set to two if an error occurs.
 *
 */
static void
execute(char *queue, char *server)
{
	int ct;         /* Connection to the server */
	int merr;       /* Error return from pbs_manager */
	char *errmsg;   /* Error message from pbs_manager */
	/* The disable request */
	static struct attropl attr = {NULL, "started", NULL, "FALSE", SET};

	if ((ct = cnt2server(server)) > 0) {
		merr = pbs_manager(ct, MGR_CMD_SET, MGR_OBJ_QUEUE, queue, &attr, NULL);
		if (merr != 0) {
			errmsg = pbs_geterrmsg(ct);
			if (errmsg != NULL) {
				fprintf(stderr, "qstop: %s ", errmsg);
			} else {
				fprintf(stderr, "qstop: Error (%d) disabling queue ", pbs_errno);
			}
			if (notNULL(queue))
				fprintf(stderr, "%s", queue);
			if (notNULL(server))
				fprintf(stderr, "@%s", server);
			fprintf(stderr, "\n");
			exitstatus = 2;
		}
		pbs_disconnect(ct);
	} else {
		fprintf(stderr, "qstop: could not connect to server %s (%d)\n", server, pbs_errno);
		exitstatus = 2;
	}
}
コード例 #3
0
ファイル: comment.c プロジェクト: Johnlihj/torque
static int
schd_alterserver(int sv_conn, char *name, char *value)
  {
  char   *id = "schd_alterserver";
  int     err;
  AttrOpList alist;

  if (schd_TEST_ONLY)
    {
    DBPRT(("%s: Would have altered server %d:\n", id, sv_conn));
    DBPRT(("%s: name: %s, value: %s\n", id,
           name ? name : "(NULL)",
           value ? value : "(NULL)"));
    return 0;
    }

  /* Fill in the attribute struct with appropriate parameters */

  alist.resource = NULL;

  alist.value    = value;

  alist.name     = name;

  alist.next     = NULL;

  alist.op       = SET;

  err = pbs_manager(sv_conn, MGR_CMD_SET, MGR_OBJ_SERVER, "", &alist,
                    NULL);

  if (err)
    {
    (void)sprintf(log_buffer,
                  "pbs_alterserver(%s, %s) failed: %d", name, value, pbs_errno);
    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);
    }

  return (err);
  }