unantu下的tmp文件夹_ubuntu – 如何使用systemd服务或tmpfiles.d自动创建运行时文件夹?...

我正在尝试在/ 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值