Unverified Commit 80fe6046 by 0x0916 Committed by Stéphane Graber

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: 's avatar0x0916 <w@laoqinren.net>
parent 2f3f7152
...@@ -430,10 +430,18 @@ int main(int argc, char *argv[]) ...@@ -430,10 +430,18 @@ int main(int argc, char *argv[])
getpid(), mon.lxcpath); getpid(), mon.lxcpath);
for (;;) { for (;;) {
ret = lxc_mainloop(&mon.descr, 1000 * 30); ret = lxc_mainloop(&mon.descr, 1000 * 30);
if (ret) {
ERROR("mainloop returned an error");
break;
}
if (mon.clientfds_cnt <= 0) { if (mon.clientfds_cnt <= 0) {
NOTICE("No remaining clients. lxc-monitord is exiting."); NOTICE("No remaining clients. lxc-monitord is exiting.");
break; break;
} }
if (quit == 1) {
NOTICE("got quit command. lxc-monitord is exitting.");
break;
}
} }
on_signal: on_signal:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment