1

enter image description here

I'm working through https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04, and have reached the section on creating a systemd unit file.

The file is listed as in the screenshot but I'm confused by the following line:

ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown sammy:www-data /run/uwsgi'

We'll use the ExecStartPre directive to set up the pieces we need to run our server. This will make sure the /run/uwsgi directory is created and that our normal user owns it with the www-data group as the group owner. Both mkdir with the -p flag and the chown command return successfully even if their operation is not needed. This is what we want.

In plain English, what does this mean and why is it being done?

3

As the service is started, the ExecStartPre runs before the service does. In the command above it's creating a folder /run/uwsgi and then it sets the owner of that folder to the user sammy.

Per the manual...

Putting sockets in /run/ On a modern system, /run/ is mounted as a tmpfs and is the right place to put sockets and pidfiles into.

I would venture to guess the way the tutorial explains to do it is deprecated.

You can find more information on running uWSGI with Systemd here...

http://uwsgi-docs.readthedocs.io/en/latest/Systemd.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.