[lxc-devel] [lxc/master] lxc-monitord: exit when got a quit command
0x0916 on Github
lxc-bot at linuxcontainers.org
Sat Jul 1 06:09:09 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 703 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170701/72e2fd28/attachment.bin>
-------------- next part --------------
From 267bc7eda8443c3a985e5b82289ab1ed533f2e16 Mon Sep 17 00:00:00 2001
From: 0x0916 <w at laoqinren.net>
Date: Sat, 1 Jul 2017 14:04:14 +0800
Subject: [PATCH] lxc-monitord: exit when got a quit command
lxc-monitor has an option to tell lxc-monitord to quit.
```
~/lxc (master) # lxc-monitor --help
lxc-monitor monitors the state of the NAME container
Options :
-n, --name=NAME NAME of the container
NAME may be a regular expression
-Q, --quit tell lxc-monitord to quit
```
But it does not work. This patch fix that.
Signed-off-by: 0x0916 <w at laoqinren.net>
---
src/lxc/lxc_monitord.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/lxc/lxc_monitord.c b/src/lxc/lxc_monitord.c
index 456c4fc94..c4c2ba0d1 100644
--- a/src/lxc/lxc_monitord.c
+++ b/src/lxc/lxc_monitord.c
@@ -430,10 +430,18 @@ int main(int argc, char *argv[])
getpid(), mon.lxcpath);
for (;;) {
ret = lxc_mainloop(&mon.descr, 1000 * 30);
+ if (ret) {
+ ERROR("mainloop returned an error");
+ break;
+ }
if (mon.clientfds_cnt <= 0) {
NOTICE("No remaining clients. lxc-monitord is exiting.");
break;
}
+ if (quit == 1) {
+ NOTICE("got quit command. lxc-monitord is exitting.");
+ break;
+ }
}
on_signal:
More information about the lxc-devel
mailing list