Ejemplo n.º 1
0
struct bnode *
cron_create(char *ainstance, char *acommand, char *awhen)
{
    struct cronbnode *te;
    afs_int32 code;
    char *cmdpath;
    extern char *copystr();

    /* construct local path from canonical (wire-format) path */
    if (ConstructLocalBinPath(acommand, &cmdpath)) {
	bozo_Log("BNODE: command path invalid '%s'\n", acommand);
	return NULL;
    }

    te = (struct cronbnode *)malloc(sizeof(struct cronbnode));
    memset(te, 0, sizeof(struct cronbnode));
    code = ktime_ParsePeriodic(awhen, &te->whenToRun);
    if ((code < 0) || (bnode_InitBnode(te, &cronbnode_ops, ainstance) != 0)) {
	free(te);
	free(cmdpath);
	return NULL;
    }
    te->when = ktime_next(&te->whenToRun, 0);
    te->command = cmdpath;
    te->whenString = copystr(awhen);
    return (struct bnode *)te;
}
Ejemplo n.º 2
0
struct bnode *
ez_create(char *ainstance, char *acommand, char *unused1, char *unused2,
	  char *unused3, char *unused4)
{
    struct ezbnode *te;
    char *cmdpath;

    if (ConstructLocalBinPath(acommand, &cmdpath)) {
	bozo_Log("BNODE: command path invalid '%s'\n", acommand);
	return NULL;
    }

    te = calloc(1, sizeof(struct ezbnode));
    if (bnode_InitBnode((struct bnode *)te, &ezbnode_ops, ainstance) != 0) {
	free(te);
	return NULL;
    }
    te->command = cmdpath;
    return (struct bnode *)te;
}