mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
initctl: if the system doesn't have logs, skip it in status output
On, e.g., a container based system logs may not be available so check also that the messages fallback exists instead of causing confusing error in the status output for the service. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
0e695aa0c7
commit
078a1d0c95
1 file changed
+4
-1
+4
-1
@@ -161,8 +161,11 @@ static int do_log(char *svc)
|
|||||||
if (!svc || !svc[0])
|
if (!svc || !svc[0])
|
||||||
svc = "finit";
|
svc = "finit";
|
||||||
|
|
||||||
if (!fexist(logfile))
|
if (!fexist(logfile)) {
|
||||||
logfile = "/var/log/messages";
|
logfile = "/var/log/messages";
|
||||||
|
if (!fexist(logfile))
|
||||||
|
return 0; /* bail out, maybe in container */
|
||||||
|
}
|
||||||
|
|
||||||
return systemf("cat %s | grep %s | tail -10", logfile, svc);
|
return systemf("cat %s | grep %s | tail -10", logfile, svc);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user