You are not logged in.
Pages: 1
I have recently switched to systemd because initscripts support is dropped and i have to admit that the new system is way more convenient and better to configure.
However, i have still two issues:
1. I have no quiet option in my kernel line (grub config), because i like to see what's happening. But if systemd enters the multiuser target, where i get asked for my user credentials, the user input gets cluttered with some more status messages. I can still login, it's just a visual issue. How can i achieve that this does not happen?
2. The other thing is that i can't get uWSGI to stop properly. If I do a uwsgi --stop /tmp/myuwsgi.pid, it reloads itself immediately after that so that it cannot be stopped that way.
My logfile
...
Fri Feb 15 19:04:08 2013 - SIGINT/SIGQUIT received...killing workers...
Fri Feb 15 19:04:08 2013 - ...brutally killing workers...
Fri Feb 15 19:04:08 2013 - binary reloading uWSGI...
...sudo systemctl status uwsgi.service
$ sudo systemctl status uwsgi.service
uwsgi.service - uWSGI Server
Loaded: loaded (/etc/systemd/system/uwsgi.service; enabled)
Active: failed (Result: signal) since Fri 2013-02-15 19:05:38 CET; 4min 12s ago
Process: 8119 ExecStop=/home/alp/env/bin/uwsgi --stop /tmp/myuwsgi.pid (code=exited, status=0/SUCCESS)
Process: 8111 ExecStart=/home/alp/env/bin/uwsgi --uid alp --home /home/alp/env --pythonpath /home/alp/project --module project.wsgi --pidfile /tmp/myuwsgi.pid --socket /tmp/myuwsgi.socket --chmod-socket --buffer-size 65536 --optimize 2 --processes 4 --master --logto /home/alp/env/log/uwsgi.log --logdate --no-site --python-autoreload /home/alp/project (code=killed, signal=KILL)
Feb 15 19:04:00 alppc systemd[1]: Starting uWSGI Server...
Feb 15 19:04:00 alppc systemd[1]: Started uWSGI Server.
Feb 15 19:04:08 alppc systemd[1]: Stopping uWSGI Server...
Feb 15 19:05:38 alppc systemd[1]: uwsgi.service stopping timed out. Killing.
Feb 15 19:05:38 alppc systemd[1]: uwsgi.service: main process exited, code=killed, status=9/KILL
Feb 15 19:05:38 alppc systemd[1]: Stopped uWSGI Server.
Feb 15 19:05:38 alppc systemd[1]: Unit uwsgi.service entered failed state/etc/systemd/system/uwsgi.service
[Unit]
Description=uWSGI Server
After=network.target
[Service]
PIDFile=/tmp/myuwsgi.pid
ExecStart=/home/alp/env/bin/uwsgi \
--uid alp \
--home /home/alp/env \
--pythonpath /home/alp/project \
--module project.wsgi \
--pidfile /tmp/myuwsgi.pid \
--socket /tmp/myuwsgi.socket \
--chmod-socket \
--buffer-size 65536 \
--optimize 2 \
--processes 4 \
--master \
--logto /home/alp/env/log/uwsgi.log \
--logdate \
--no-site \
--python-autoreload /home/alp/project
ExecReload=/home/alp/env/bin/uwsgi --reload /tmp/myuwsgi.pid
ExecStop=/home/alp/env/bin/uwsgi --stop /tmp/myuwsgi.pid
#ExecStop=kill -9 `cat /tmp/myuwsgi.pid`
#ExecStop=killall -9 uwsgi
[Install]
WantedBy=multi-user.targetI tried to use kill and killall as a workaround in the config file as you can see, but that does not work either (just if i run them by hand, and then only sometimes). Any ideas how i can get uWSGI to stop its service in the uwsgi --stop way?
Offline
I am still struggling with this. The following line in my service config is the culprit:
ExecStop=/home/alp/env/bin/uwsgi --stop /tmp/myuwsgi.pidIf i execute this command manually in the console, uWSGI stops as requested and doesn't do an automatic reload:
SIGINT/SIGQUIT received...killing workers...
goodbye to uWSGI.But if i execute
sudo systemctl stop uwsgi.servicesomehow systemd does not use that command, instead it just kills the process:
...brutally killing workers...
binary reloading uWSGI...That causes the uWSGI server immediately to restart, systemd doesn't get the expected return value and waits until it timeouts.
Help anyone?
Last edited by Alp (2013-04-15 19:28:31)
Offline
Finally, i got it!
Add this line to your service configuration file in your [Service] section:
KillMode=noneAlso i changed the Type parameter from forking to notify:
Type=notifyHere is the complete file:
[Unit]
Description=uWSGI Server
After=network.target
[Service]
Type=notify
KillMode=none
Restart=Always
PIDFile=/tmp/myuwsgi.pid
ExecStart=/home/alp/env/bin/uwsgi \
--uid alp \
--home /home/alp/env \
--pythonpath /home/alp/project \
--module project.wsgi \
--pidfile /tmp/myuwsgi.pid \
--socket /tmp/myuwsgi.socket \
--chmod-socket \
--buffer-size 65536 \
--optimize 2 \
--processes 4 \
--master \
--logto /home/alp/env/log/uwsgi.log \
--logdate \
--no-site \
--python-autoreload /home/alp/project
ExecReload=/home/alp/env/bin/uwsgi --reload /tmp/myuwsgi.pid
ExecStop=/home/alp/env/bin/uwsgi --stop /tmp/myuwsgi.pid
[Install]
WantedBy=multi-user.targetOffline
If you're using Type=notify, there's zero need for a pidfile. Upstream documents systemd integration rather thoroughly...
Offline
Pages: 1