mirror of
https://github.com/troglobit/finit.git
synced 2026-10-24 11:54:36 +00:00
Use -v to also dump asserted condition flags in cond show
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
bc84d66018
commit
1edfecdaab
1 file changed
+29
-1
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <glob.h>
|
||||||
|
#include <paths.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
@@ -34,6 +36,8 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
|
|
||||||
|
#define _PATH_COND _PATH_VARRUN "finit/cond/"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int (*cb)(char *arg);
|
int (*cb)(char *arg);
|
||||||
@@ -202,6 +206,30 @@ static int do_cond_show(char *UNUSED(arg))
|
|||||||
svc_t *svc;
|
svc_t *svc;
|
||||||
enum cond_state cond;
|
enum cond_state cond;
|
||||||
|
|
||||||
|
if (verbose) {
|
||||||
|
glob_t gl;
|
||||||
|
|
||||||
|
printf("Asserted conditions (taken from %s)\n", _PATH_COND);
|
||||||
|
printf("====================================================================================\n");
|
||||||
|
|
||||||
|
if (!glob(_PATH_COND "*/*/*", 0, NULL, &gl)) {
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < gl.gl_pathc; i++) {
|
||||||
|
char *cond, *name = gl.gl_pathv[i];
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
if (stat(name, &st) || S_ISDIR(st.st_mode))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
cond = name + strlen(_PATH_COND);
|
||||||
|
printf("\t%s\n", cond);
|
||||||
|
}
|
||||||
|
globfree(&gl);
|
||||||
|
}
|
||||||
|
puts("");
|
||||||
|
}
|
||||||
|
|
||||||
printf("PID Service Status Condition (+ on, ~ flux, - off)\n");
|
printf("PID Service Status Condition (+ on, ~ flux, - off)\n");
|
||||||
printf("====================================================================================\n");
|
printf("====================================================================================\n");
|
||||||
|
|
||||||
@@ -219,7 +247,7 @@ static int do_cond_show(char *UNUSED(arg))
|
|||||||
printf("\e[1m%-6.6s\e[0m ", condstr(cond));
|
printf("\e[1m%-6.6s\e[0m ", condstr(cond));
|
||||||
|
|
||||||
show_cond_one(svc->cond);
|
show_cond_one(svc->cond);
|
||||||
putchar('\n');
|
puts("");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in new issue
Block a user