Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So I wrote this simple systemd service script:-

Description=uwsgi server script

ExecStart=/bin/bash -c 'source ~/.bash_profile; workon myproject; uwsgi --ini /var/www/prod/myproject/releases/current/myproject/uwsgi_prod.ini'


which works fine - it starts up and I can see my uwsgi processes in htop.

However, it inexplicably shuts down after being idle for 5 minutes.

If I start this process manually in bash console by executing, as web user:-

source ~/.bash_profile
workon myproject
uwsgi --ini /var/www/prod/myproject/releases/current/myproject/uwsgi_prod.ini

my process does not die after being idle.

What could the problem be?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Solved it after chatting with another dev on systemd channel.

Adding this into the [Service] section solved the problem:-


The reason is simple. If Type isn't declared, the default is Type=simple, which expects the process does NOT fork so when bash exits, systemd thinks the process is dead and tears down the cgroup.

share|improve this answer

As you noted, you need to specify the Type otherwise systemd defaults to Type=simple.

However, the official uWSGI docs on managing uWSGI with systemd use Type=notify rather than Type=forking because then there's no need to specify the PIDFile.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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