<div dir="ltr">Well, it runs fine by itself using the exact same command on the command line.<div>Its when systemd is added to the mix that the problems occur</div><div>The people that put out celery have docs on how to use it with systemd, its just that they don't work:</div><div><a href="http://docs.celeryproject.org/en/latest/userguide/daemonizing.html">http://docs.celeryproject.org/en/latest/userguide/daemonizing.html</a><br></div><div>I based my service off theirs but the Type=forking was copied right from theirs</div><div>Maybe if I use their version more exactly it might work.</div><div>But their version doesn't work at all ssince I suspect they are using templating</div><div>( I copied the %I from their file )</div><div>They reference config variables in their template:</div><div><br></div><div><code class="gmail-file gmail-docutils gmail-literal" style="color:rgb(62,67,73);font-size:17px"><span class="gmail-pre" style="hyphens: none;">/etc/systemd/system/celery.service</span></code><span style="color:rgb(62,67,73);font-family:Optima,Segoe,"Segoe UI",Candara,Calibri,Arial,sans-serif;font-size:17px">:</span><br></div><div><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.9em;background:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-radius:2px;line-height:1.3em;color:rgb(62,67,73)"><span class="gmail-o" style="color:rgb(51,51,51)">[</span>Unit<span class="gmail-o" style="color:rgb(51,51,51)">]</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">Description</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>Celery Service
<span class="gmail-nv" style="color:rgb(153,102,51)">After</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>network.target

<span class="gmail-o" style="color:rgb(51,51,51)">[</span>Service<span class="gmail-o" style="color:rgb(51,51,51)">]</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">Type</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>forking
<span class="gmail-nv" style="color:rgb(153,102,51)">User</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>celery
<span class="gmail-nv" style="color:rgb(153,102,51)">Group</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>celery
<span class="gmail-nv" style="color:rgb(153,102,51)">EnvironmentFile</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>-/etc/conf.d/celery
<span class="gmail-nv" style="color:rgb(153,102,51)">WorkingDirectory</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>/opt/celery
<span class="gmail-nv" style="color:rgb(153,102,51)">ExecStart</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>/bin/sh -c <span class="gmail-s1" style="background-color:rgb(255,240,240)">'${CELERY_BIN} multi start ${CELERYD_NODES} \</span>
<span class="gmail-s1" style="background-color:rgb(255,240,240)">  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \</span>
<span class="gmail-s1" style="background-color:rgb(255,240,240)">  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">ExecStop</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>/bin/sh -c <span class="gmail-s1" style="background-color:rgb(255,240,240)">'${CELERY_BIN} multi stopwait ${CELERYD_NODES} \</span>
<span class="gmail-s1" style="background-color:rgb(255,240,240)">  --pidfile=${CELERYD_PID_FILE}'</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">ExecReload</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>/bin/sh -c <span class="gmail-s1" style="background-color:rgb(255,240,240)">'${CELERY_BIN} multi restart ${CELERYD_NODES} \</span>
<span class="gmail-s1" style="background-color:rgb(255,240,240)">  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \</span>
<span class="gmail-s1" style="background-color:rgb(255,240,240)">  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'</span>

<span class="gmail-o" style="color:rgb(51,51,51)">[</span>Install<span class="gmail-o" style="color:rgb(51,51,51)">]</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">WantedBy</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span>multi-user.target</pre><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.9em;background:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-radius:2px;line-height:1.3em;color:rgb(62,67,73)"><div class="gmail-section" id="example-configuration" style="font-family:Optima,Segoe,"Segoe UI",Candara,Calibri,Arial,sans-serif;font-size:17px;white-space:normal;background-color:rgb(255,255,255)"><p style="line-height:1.4em"><code class="gmail-file gmail-docutils gmail-literal"><span class="gmail-pre" style="hyphens: none;">/etc/default/celeryd</span></code>:</p><div class="gmail-highlight-bash"><div class="gmail-highlight" style="background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.9em;background:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-radius:2px;line-height:1.3em"><span class="gmail-c1" style="color:rgb(136,136,136)"># Names of nodes to start</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#   most people will only start one node:</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_NODES</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"worker1"</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#   but you can also start multiple and configure settings</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#   for each in CELERYD_OPTS</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#CELERYD_NODES="worker1 worker2 worker3"</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#   alternatively, you can specify the number of nodes to start:</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#CELERYD_NODES=10</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># Absolute or relative path to the 'celery' command:</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERY_BIN</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"/usr/local/bin/celery"</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#CELERY_BIN="/virtualenvs/def/bin/celery"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># App instance to use</span>
<span class="gmail-c1" style="color:rgb(136,136,136)"># comment out this line if you don't use an app</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERY_APP</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"proj"</span>
<span class="gmail-c1" style="color:rgb(136,136,136)"># or fully qualified:</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#CELERY_APP="proj.tasks:app"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># Where to chdir at start.</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_CHDIR</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"/opt/Myproject/"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># Extra command-line arguments to the worker</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_OPTS</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"--time-limit=300 --concurrency=8"</span>
<span class="gmail-c1" style="color:rgb(136,136,136)"># Configure node-specific settings by appending node name to arguments:</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#CELERYD_OPTS="--time-limit=300 -c 8 -c:worker2 4 -c:worker3 2 -Ofair:worker1"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># Set logging level to DEBUG</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#CELERYD_LOG_LEVEL="DEBUG"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># %n will be replaced with the first part of the nodename.</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_LOG_FILE</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"/var/log/celery/%n%I.log"</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_PID_FILE</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"/var/run/celery/%n.pid"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># Workers should run as an unprivileged user.</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#   You need to create this user manually (or you can choose</span>
<span class="gmail-c1" style="color:rgb(136,136,136)">#   a user/group combination that already exists (e.g., nobody).</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_USER</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"celery"</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERYD_GROUP</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-s2" style="background-color:rgb(255,240,240)">"celery"</span>

<span class="gmail-c1" style="color:rgb(136,136,136)"># If enabled pid and log directories will be created if missing,</span>
<span class="gmail-c1" style="color:rgb(136,136,136)"># and owned by the userid/group configured.</span>
<span class="gmail-nv" style="color:rgb(153,102,51)">CELERY_CREATE_DIRS</span><span class="gmail-o" style="color:rgb(51,51,51)">=</span><span class="gmail-m" style="color:rgb(102,0,238);font-weight:bold">1</span>
</pre><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.9em;background:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-radius:2px;line-height:1.3em"><span class="gmail-m" style="color:rgb(102,0,238);font-weight:bold">But nowhere in their documentation is any mention of the fact that they are using templates or how how make a service a template.</span></pre><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.9em;background:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-radius:2px;line-height:1.3em"><span class="gmail-m" style="color:rgb(102,0,238);font-weight:bold"> Is there docs on this you can point me to? Or if not just explain it?</span></pre><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,"Deja Vu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:0.9em;background:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-radius:2px;line-height:1.3em"><span class="gmail-m" style="color:rgb(102,0,238);font-weight:bold"><br></span></pre></div></div></div><div class="gmail-section" id="gmail-using-a-login-shell" style="font-family:Optima,Segoe,"Segoe UI",Candara,Calibri,Arial,sans-serif;font-size:17px;white-space:normal;background-color:rgb(255,255,255)"></div></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 5, 2017 at 1:50 PM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Di, 05.12.17 13:33, Doug Snyder (<a href="mailto:webcoach101@gmail.com">webcoach101@gmail.com</a>) wrote:<br>
<br>
> Getting rid of the template syntax changed the behavior but now it appears<br>
> there's another problem I don't understand.<br>
> it tries to start the unit and it shows some encouraging signs but fails<br>
> because a timeout was exceeded.<br>
> Celery starts and shows healthy output but then sends a SIGCHLD and then<br>
> dies<br>
<br>
</span>Uh, I am not sure what celery is, but if celery is started but exits<br>
on its own then I am not sure I can help you very much.<br>
<span class=""><br>
> I don't know if you know what celery is but its a task queue so it does<br>
> create child processes<br>
> I thought the Type=forking line in the service unit would let systemd about<br>
> that.<br>
> Or maybe its dying for some other reason?<br>
> It works fine when run without systemd<br>
<br>
</span>Does it detach on its own? i.e. double fork? if yes, then type=forking<br>
is the right choice, otherwise you need a different Type=.<br>
<span class=""><br>
> I don't think I can send you detailed output until we get this issue<br>
> resolved with the mailing list and why its not excepting emails with debug<br>
> output.<br>
> Short emails seem to post. Long ones don't. There's no indication of whats<br>
> going on<br>
<br>
</span>There are message size limits on this mailing list. Please condense<br>
your logs to only include relevant bits hence, or use <a href="http://fpaste.org" rel="noreferrer" target="_blank">fpaste.org</a> or<br>
something like that, and drop the URL.<br>
<div class="HOEnZb"><div class="h5"><br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Red Hat<br>
</div></div></blockquote></div><br></div></div>