<h4 dir="auto">Related Issues</h4>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="591135324" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/6017" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/6017/hovercard" href="https://github.com/celery/celery/issues/6017">#6017</a>  Celery Multi creates pid and log files in the wrong directory</p>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# celery report

software -&gt; celery:4.4.3 (cliffs) kombu:4.6.9 py:3.7.7
            billiard:3.6.3.0 py-amqp:2.6.0
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:4.19.0-8-amd64 imp:CPython
loader   -&gt; celery.loaders.default.Loader
settings -&gt; transport:amqp results:disabled
"><pre class="notranslate"><code class="notranslate"># celery report

software -&gt; celery:4.4.3 (cliffs) kombu:4.6.9 py:3.7.7
            billiard:3.6.3.0 py-amqp:2.6.0
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:4.19.0-8-amd64 imp:CPython
loader   -&gt; celery.loaders.default.Loader
settings -&gt; transport:amqp results:disabled

</code></pre></div>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Celery Version</strong>: 4.4.3</li>
</ul>
<p dir="auto"></p>

<h2 dir="auto">Minimally Reproducible Test Case</h2>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery multi start ... --pidfile=/var/run/demo/celeryd-%n.pid"><pre class="notranslate"><code class="notranslate">celery multi start ... --pidfile=/var/run/demo/celeryd-%n.pid
</code></pre></div>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">celery runs</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">start failed</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery multi v4.4.3 (cliffs)
_annotate_with_default_opts: print options
OrderedDict([('--app', 'service.celery:app'),
             ('--pidfile', '/var/run/demo/celeryd-%n.pid'),
             ('--logfile', '/var/log/demo/celeryd-%n%I.log'),
             ('--loglevel', 'INFO'),
             ('--workdir', '/var/lib/demo-celery'),
             ('--events', None),
             ('--heartbeat-interval', '5'),
             ('--without-gossip', None),
             ('--queues', 'high'),
             ('--concurrency', '1'),
             ('-n', 'high@celeryd.worker')])
Traceback (most recent call last):
  File &quot;/var/www/misc/ve-2006011156/bin/celery&quot;, line 8, in &lt;module&gt;
    sys.exit(main())
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/__main__.py&quot;, line 16, in main
    _main()
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py&quot;, line 322, in main
    cmd.execute_from_commandline(argv)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py&quot;, line 495, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/base.py&quot;, line 305, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py&quot;, line 487, in handle_argv
    return self.execute(command, argv)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py&quot;, line 419, in execute
    ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py&quot;, line 335, in run_from_argv
    return cmd.execute_from_commandline([command] + argv)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py&quot;, line 266, in execute_from_commandline
    return self.call_command(argv[0], argv[1:])
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py&quot;, line 273, in call_command
    return self.commands[command](*argv) or EX_OK
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py&quot;, line 143, in _inner
    return fun(self, *args, **kwargs)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py&quot;, line 151, in _inner
    return fun(self, self.cluster_from_argv(argv), **kwargs)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py&quot;, line 361, in cluster_from_argv
    _, cluster = self._cluster_from_argv(argv, cmd=cmd)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py&quot;, line 366, in _cluster_from_argv
    return p, self.Cluster(list(nodes), cmd=cmd)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py&quot;, line 306, in &lt;genexpr&gt;
    for name in names
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py&quot;, line 314, in _node_from_options
    p.optmerge(namespace, options), p.passthrough)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py&quot;, line 136, in __init__
    options or OrderedDict())
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py&quot;, line 145, in _annotate_with_default_opts
    self._setdefaultopt(options, ['--pidfile', '-p'], '/var/run/celery/%n.pid')
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py&quot;, line 159, in _setdefaultopt
    os.makedirs(dir_path)
  File &quot;/var/www/misc/ve-2006011156/lib/python3.7/os.py&quot;, line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/run/celery'

systemd[1]: demo@celeryd.service: Control process exited, code=exited, status=1/FAILURE"><pre class="notranslate"><code class="notranslate">celery multi v4.4.3 (cliffs)
_annotate_with_default_opts: print options
OrderedDict([('--app', 'service.celery:app'),
             ('--pidfile', '/var/run/demo/celeryd-%n.pid'),
             ('--logfile', '/var/log/demo/celeryd-%n%I.log'),
             ('--loglevel', 'INFO'),
             ('--workdir', '/var/lib/demo-celery'),
             ('--events', None),
             ('--heartbeat-interval', '5'),
             ('--without-gossip', None),
             ('--queues', 'high'),
             ('--concurrency', '1'),
             ('-n', 'high@celeryd.worker')])
Traceback (most recent call last):
  File "/var/www/misc/ve-2006011156/bin/celery", line 8, in &lt;module&gt;
    sys.exit(main())
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py", line 495, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/base.py", line 305, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py", line 487, in handle_argv
    return self.execute(command, argv)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py", line 419, in execute
    ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/celery.py", line 335, in run_from_argv
    return cmd.execute_from_commandline([command] + argv)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py", line 266, in execute_from_commandline
    return self.call_command(argv[0], argv[1:])
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py", line 273, in call_command
    return self.commands[command](*argv) or EX_OK
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py", line 143, in _inner
    return fun(self, *args, **kwargs)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py", line 151, in _inner
    return fun(self, self.cluster_from_argv(argv), **kwargs)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py", line 361, in cluster_from_argv
    _, cluster = self._cluster_from_argv(argv, cmd=cmd)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/bin/multi.py", line 366, in _cluster_from_argv
    return p, self.Cluster(list(nodes), cmd=cmd)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py", line 306, in &lt;genexpr&gt;
    for name in names
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py", line 314, in _node_from_options
    p.optmerge(namespace, options), p.passthrough)
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py", line 136, in __init__
    options or OrderedDict())
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py", line 145, in _annotate_with_default_opts
    self._setdefaultopt(options, ['--pidfile', '-p'], '/var/run/celery/%n.pid')
  File "/var/www/misc/ve-2006011156/lib/python3.7/site-packages/celery/apps/multi.py", line 159, in _setdefaultopt
    os.makedirs(dir_path)
  File "/var/www/misc/ve-2006011156/lib/python3.7/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/run/celery'

systemd[1]: demo@celeryd.service: Control process exited, code=exited, status=1/FAILURE
</code></pre></div>
<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<h1 dir="auto">Actual Behavior</h1>