1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-05 04:07:10 +01:00

Dump more information in service status command

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-03-19 23:58:19 +01:00
parent 1850f31d6d
commit 4f1b393cee

View file

@ -28,6 +28,7 @@ static int cmd_status(int argc, char **argv)
init_status_response_t resp;
char tmppath[256];
const char *state;
service_t *svc;
for (;;) {
i = getopt_long(argc, argv, short_opts, long_opts, NULL);
@ -125,6 +126,21 @@ static int cmd_status(int argc, char **argv)
printf("\tStatus: %s\n", state);
printf("\tTemplate name: %s\n", resp.service_name);
printf("\tExit status: %d\n", resp.exit_status);
svc = loadsvc(SVCDIR, resp.filename,
RDSVC_NO_EXEC | RDSVC_NO_DEPS |
RDSVC_NO_CTTY | RDSVC_NO_FNAME);
if (svc == NULL) {
fputs("\tError loading service file\n", stdout);
} else {
printf("\tDescription: %s\n", svc->desc);
printf("\tType: %s\n",
svc_type_to_string(svc->type));
printf("\tTarget: %s\n",
svc_target_to_string(svc->target));
delsvc(svc);
}
} else {
printf("[%s] %s\n", state, resp.filename);
}