mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +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:
+4
-1
@@ -161,8 +161,11 @@ static int do_log(char *svc)
|
||||
if (!svc || !svc[0])
|
||||
svc = "finit";
|
||||
|
||||
if (!fexist(logfile))
|
||||
if (!fexist(logfile)) {
|
||||
logfile = "/var/log/messages";
|
||||
if (!fexist(logfile))
|
||||
return 0; /* bail out, maybe in container */
|
||||
}
|
||||
|
||||
return systemf("cat %s | grep %s | tail -10", logfile, svc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user