Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

What is the function of sytemd's execstartpre directive?

Writer Matthew Harrington

enter image description here

I'm working through , 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?

1 Answer

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...

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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