我正在尝试在/ run / gunicorn为一些Gunicorn套接字/ PID文件创建一个运行时文件夹,这些文件适用于Django应用程序.如果我手动创建目录,我可以使一切正常.但是,我正在尝试使其成为一个强大的设置,并最终使用Ansible自动化所有内容.
我想我有两个选项,基于这个question.
选项1 – RuntimeDirectory
我认为第一个选项是在我的systemd服务文件中使用RuntimeDirectory =,但我无法创建该文件夹.服务文件包含:
#/etc/systemd/system/gunicorn_django_test.service
[Unit]
Description=gunicorn_django daemon
After=network.target
[Service]
User=gunicorn
Group=www-data
RuntimeDirectory=gunicorn #This line is supposed to create a directory
RuntimeDirectoryMode=755
PIDFile=/run/gunicorn/django_test_pid
WorkingDirectory=/vagrant/webapps/django_venv/django_test
ExecStart=/vagrant/webapps/django_venv/bin/gunicorn --pid /run/gunicorn/django_test_pid --workers 3 --bind unix:/run/gunicorn/django_test_socket django_test.wsgi --error-logfile /var/log/gunicorn/d