Skip to content

Commit

Permalink
lxc-monitord: exit when got a quit command
Browse files Browse the repository at this point in the history
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@laoqinren.net>
  • Loading branch information
0x0916 authored and stgraber committed Jul 16, 2017
1 parent 2f3f715 commit 80fe604
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lxc/lxc_monitord.c
Expand Up @@ -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:
Expand Down

0 comments on commit 80fe604

Please sign in to comment.