mirror of
https://github.com/troglobit/finit.git
synced 2026-11-28 20:58:24 +00:00
initctl: status command formatting updates, add origin .conf file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
b3ea23ed26
commit
fe27ed17eb
3 files changed
+19
-6
No files matched your search
+11
-3
@@ -492,15 +492,23 @@ static int show_status(char *arg)
|
|||||||
if (arg && arg[0]) {
|
if (arg && arg[0]) {
|
||||||
long now = jiffies();
|
long now = jiffies();
|
||||||
char buf[42] = "N/A";
|
char buf[42] = "N/A";
|
||||||
|
char cmd[512];
|
||||||
|
|
||||||
svc = client_svc_find(arg);
|
svc = client_svc_find(arg);
|
||||||
if (!svc)
|
if (!svc)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
printf("Service : %s\n", svc->cmd);
|
strlcat(cmd, svc->cmd, sizeof(cmd));
|
||||||
printf("Description : %s\n", svc->desc);
|
for (int i = 1; svc->args[i] && i < MAX_NUM_SVC_ARGS; i++) {
|
||||||
|
strlcat(cmd, " ", sizeof(cmd));
|
||||||
|
strlcat(cmd, svc->args[i], sizeof(cmd));
|
||||||
|
}
|
||||||
|
|
||||||
printf("Identity : %s\n", svc_ident(svc, ident, sizeof(ident)));
|
printf("Identity : %s\n", svc_ident(svc, ident, sizeof(ident)));
|
||||||
|
printf("Description : %s\n", svc->desc);
|
||||||
|
printf("Origin : %s\n", svc->file[0] ? svc->file : "built-in");
|
||||||
printf("Environment : %s\n", svc->env);
|
printf("Environment : %s\n", svc->env);
|
||||||
|
printf("Command : %s\n", cmd);
|
||||||
printf("PID : %d\n", svc->pid);
|
printf("PID : %d\n", svc->pid);
|
||||||
printf("Uptime : %s\n", svc->pid ? uptime(now - svc->start_time, buf, sizeof(buf)) : buf);
|
printf("Uptime : %s\n", svc->pid ? uptime(now - svc->start_time, buf, sizeof(buf)) : buf);
|
||||||
printf("Runlevels : %s\n", runlevel_string(runlevel, svc->runlevels));
|
printf("Runlevels : %s\n", runlevel_string(runlevel, svc->runlevels));
|
||||||
@@ -760,7 +768,7 @@ int main(int argc, char *argv[])
|
|||||||
{ "stop", do_stop },
|
{ "stop", do_stop },
|
||||||
{ "restart", do_restart },
|
{ "restart", do_restart },
|
||||||
{ "status", show_status },
|
{ "status", show_status },
|
||||||
{ "show", show_status }, /* Convenience alias */
|
{ "show", show_status }, /* Convenience alias, for now */
|
||||||
|
|
||||||
{ "ps", show_cgroup },
|
{ "ps", show_cgroup },
|
||||||
|
|
||||||
|
|||||||
@@ -1162,6 +1162,8 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
|||||||
strlcpy(svc->desc, desc, sizeof(svc->desc));
|
strlcpy(svc->desc, desc, sizeof(svc->desc));
|
||||||
if (env)
|
if (env)
|
||||||
parse_env(svc, env);
|
parse_env(svc, env);
|
||||||
|
if (file)
|
||||||
|
strlcpy(svc->file, file, sizeof(svc->file));
|
||||||
|
|
||||||
/* Set configured limits */
|
/* Set configured limits */
|
||||||
memcpy(svc->rlimit, rlimit, sizeof(svc->rlimit));
|
memcpy(svc->rlimit, rlimit, sizeof(svc->rlimit));
|
||||||
|
|||||||
@@ -86,9 +86,8 @@ typedef enum {
|
|||||||
typedef struct svc {
|
typedef struct svc {
|
||||||
TAILQ_ENTRY(svc) link;
|
TAILQ_ENTRY(svc) link;
|
||||||
|
|
||||||
/* Instance specifics */
|
/* Origin of service */
|
||||||
int job; /* JOB: */
|
char file[MAX_ARG_LEN];
|
||||||
char id[MAX_ID_LEN]; /* :ID */
|
|
||||||
|
|
||||||
/* Limits and scoping */
|
/* Limits and scoping */
|
||||||
struct rlimit rlimit[RLIMIT_NLIMITS];
|
struct rlimit rlimit[RLIMIT_NLIMITS];
|
||||||
@@ -110,7 +109,11 @@ typedef struct svc {
|
|||||||
int sighup; /* This service supports SIGHUP :) */
|
int sighup; /* This service supports SIGHUP :) */
|
||||||
svc_block_t block; /* Reason that this service is currently stopped */
|
svc_block_t block; /* Reason that this service is currently stopped */
|
||||||
char cond[MAX_COND_LEN];
|
char cond[MAX_COND_LEN];
|
||||||
|
|
||||||
|
/* Instance specifics */
|
||||||
|
int job; /* For intenal use only, canonical ref is NAME:ID */
|
||||||
char name[MAX_ARG_LEN];
|
char name[MAX_ARG_LEN];
|
||||||
|
char id[MAX_ID_LEN]; /* :ID */
|
||||||
|
|
||||||
/* Counters */
|
/* Counters */
|
||||||
char once; /* run/task, (at least) once per runlevel */
|
char once; /* run/task, (at least) once per runlevel */
|
||||||
|
|||||||
Reference in new issue
Block a user