rest: add timestamp to shell/output

Provide a timestamp that tells when the command output from client was received.
master
OpenGnSys Support Team 2024-06-21 15:11:52 +02:00
parent 6cbe69e89e
commit 6a65b72114
3 changed files with 3 additions and 0 deletions

View File

@ -205,6 +205,7 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data)
free((void *)cli->shell.cmd);
free((void *)cli->shell.output);
cli->shell.tstamp = time(NULL);
cli->shell.cmd = strdup(cmd);
cli->shell.output = strdup(output);
cli->shell.retcode = retcode;

View File

@ -813,6 +813,7 @@ static int og_cmd_run_get(json_t *element, struct og_msg_params *params,
}
json_object_set_new(object, "output", output);
json_object_set_new(object, "retcode", json_integer(cli->shell.retcode));
json_object_set_new(object, "tstamp", json_integer(cli->shell.tstamp));
json_array_append_new(array, object);
}

View File

@ -75,6 +75,7 @@ struct og_client {
const char *cmd;
const char *output;
uint32_t retcode;
time_t tstamp;
} shell;
};