[systemd-devel] Logroate + Pass signal to executable in container (nspawn)
Peter Paule
systemd-devel at fedux.org
Tue Feb 24 00:24:43 PST 2015
Unfortunately, that doesn't help. I think the problem is, that
"nspawn" is the
main process for "systemd".
$ man systemctl
--kill-who
[...]
This is different for service units of other types, where the process forked
off by the manager for ExecStart= is always the main process itself.
[...]
$ pstree -p
systemd(1)---systemd-nspawn(15888)---nginx(15889)-+-nginx(15891)
`-nginx(15892)
Starting service
$ sudo systemctl start nginx at example_org
Killing service
$ sudo systemctl kill --kill-who main --signal SIGUSR1 nginx at example_org
Show status
$ sudo systemctl status nginx at example_org
● nginx at example_org.service - Webservice for example_org
Loaded: loaded (/etc/systemd/system/nginx at .service; enabled;
vendor preset: disabled)
Active: failed (Result: signal) since Tue 2015-02-24 07:24:56 UTC; 1s ago
Process: 15351 ExecStart=/usr/bin/systemd-nspawn --register=no
--ephemeral --bind-ro ${SSL_DIR}:/etc/ssl/nginx --bind-ro
${WWW_DIR}:/srv/www --bind ${LOG_DIR}:/var/log/nginx/ --bind-ro
${SITES_DIR}:/etc/nginx/sites-enabled/ --bind-ro
${CONFIG_DIR}:/etc/nginx/other-config/ -M docker-centos-nginx
/usr/sbin/nginx (code=killed, signal=USR1)
Main PID: 15351 (code=killed, signal=USR1)
CGroup: /system.slice/system-nginx.slice/nginx at example_org.service
Feb 24 07:24:23 example_org systemd: Started Webservice for example_org.
Feb 24 07:24:23 example_org systemd: Starting Webservice for example_org...
Feb 24 07:24:23 example_org systemd-nspawn: Spawning container
docker-centos-nginx on
/var/lib/machines/.#docker-centos-nginx1426422a6c8fa88c.
Feb 24 07:24:23 example_org systemd-nspawn: Press ^] three times
within 1s to kill container.
Feb 24 07:24:56 example_org systemd: nginx at example_org.service:
main process exited, code=killed, status=10/USR1
Feb 24 07:24:56 example_org systemd: Unit nginx at example_org.service
entered failed state.
Feb 24 07:24:56 example_org systemd: nginx at example_org.service failed.
Sending the same signal to nginx directly
$ sudo systemctl kill -s SIGUSR1 nginx
Results in still running nginx
$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled;
vendor preset: disabled)
Active: active (running) since Tue 2015-02-24 08:31:35 CET; 6s ago
Process: 18377 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid;
error_log stderr; (code=exited, status=0/SUCCESS)
Main PID: 18378 (nginx)
Memory: 6.3M
CGroup: /system.slice/nginx.service
├─18378 nginx: master process /usr/bin/nginx -g pid
/run/nginx.pid; error_log stderr;
├─18379 nginx: worker process
├─18380 nginx: worker process
├─18381 nginx: worker process
├─18382 nginx: worker process
├─18383 nginx: worker process
├─18384 nginx: worker process
├─18385 nginx: worker process
├─18386 nginx: worker process
├─18387 nginx: worker process
└─18388 nginx: worker process
Feb 24 08:31:35 host systemd[1]: Starting A high performance web
server and a reverse proxy server...
Feb 24 08:31:35 host systemd[1]: Started A high performance web
server and a reverse proxy server.
More information about the systemd-devel
mailing list