title: Child terminated with exit code 2 for running celeryd service in production
body: <p>i am using celery version 5.1.2 on Ubuntu 16.04 with python 3.8 and Django 3.0 .In my production i am unable run the schedule tasks.</p>
  <p>here is my /etc/systemd/celerd.conf</p>
  <pre><code># Name of nodes to start
  # here we have a single node
  #CELERYD_NODES=&quot;w1&quot;
  CELERYD_NODES=&quot;worker1&quot;
  # or we could have three nodes:
  #CELERYD_NODES=&quot;w1 w2 w3&quot;
  
  CELERY_APP=&quot;mcam&quot;
  
  # Absolute path to &quot;manage.py&quot;
  # CELERY_BIN=&quot;/home/ravi/deploy/mcam/mcam/server/mcam/manage.py&quot;
  #CELERY_BIN=&quot;/home/ravi/.virtualenvs/lightdegree/bin/python manage.py celery&quot;
  CELERY_BIN=&quot;/home/ravi/.virtualenvs/lightdegree/bin/celery&quot;
  # How to call manage.py
  CELERYD_MULTI=&quot;celery beat&quot;
  
  # Extra command-line arguments to the worker
  # m3.medium instance has 1 vCPU. Hence the concurrency is limited to 2
  CELERYD_OPTS=&quot;--time-limit=300 --concurrency=4&quot;
  
  # %N will be replaced with the first part of the nodename.
  CELERYD_LOG_FILE=&quot;/var/log/celery/%N.log&quot;
  CELERYD_PID_FILE=&quot;/var/run/celery/%N.pid&quot;
  CELERYD_LOG_LEVEL=&quot;INFO&quot;
  </code></pre>
  <p>this my /etc/systemd/system/celeryd.service</p>
  <pre><code> [Unit]
  Description=Celery Beat Service
  After=network.target
  Requires=gunicorn.service rabbitmq-server.service
  
  [Service]
  #Type=forking
  
  User=ravi
  Group=ravi
  EnvironmentFile=/etc/systemd/celeryd.conf
  WorkingDirectory=/home/ravi/deploy/mcam/server/mcam
  #ExecStart=/home/ravi/.virtualenvs/lightdegree/bin/python manage.py celery -l debug -A mcam beat
  
  ExecStart=/home/ravi/.virtualenvs/lightdegree/bin/celery multi start ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
  #ExecStop=/home/ravi/.virtualenvs/lightdegree/bin/celery ${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
  
   # --pidfile=${CELERYD_PID_FILE}
  
  ExecReload=/home/ravi/.virtualenvs/lightdegree/bin/celery ${CELERY_BIN} multi restart ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
  
  
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  <p>here are the commands what i used and error what i am getting</p>
  <p><code>sudo systemctl daemon-reload</code></p>
  <p><code>sudo systemctl reset-failed celeryd.service</code></p>
  <p><code>sudo systemctl restart celeryd</code></p>
  <p><code>sudo systemctl status celeryd</code></p>
  <pre><code>● celeryd.service - Celery Beat Service
     Loaded: loaded (/etc/systemd/system/celeryd.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Thu 2022-03-31 06:36:48 BST; 8s ago
    Process: 17869 ExecStart=/home/ravi/.virtualenvs/lightdegree/bin/celery multi start ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_
   Main PID: 17869 (code=exited, status=0/SUCCESS)
  
  Mar 31 06:36:47 ip-xxx systemd[1]: Started Celery Beat Service.
  Mar 31 06:36:48 ip-xxx celery[17869]: celery multi v5.1.2 (sun-harmonics)
  Mar 31 06:36:48 ip-xxx celery[17869]: &gt; Starting nodes...
  Mar 31 06:36:48 ip-xxx celery[17869]:         &gt; worker1@ip-xxx: OK
  </code></pre>
  <p>Here when i open my CELERYD_LOG_FILE there is no info</p>
  <pre><code>(lightdegree) ravi@ip-xxx:~$ cd /var/log/celery/
  (lightdegree) ravi@ip-xxx:/var/log/celery$ ls
  (lightdegree) ravi@ip-xxx:/var/log/celery$ 
  </code></pre>
  <p>Here is the data what is happening when i run my command sudo journalctl -u celeryd</p>
  <pre><code>-- Logs begin at Fri 2022-03-04 20:30:05 GMT, end at Thu 2022-03-31 06:57:02 BST. --
  Mar 04 20:33:00 ip-xxx python[30931]: [2022-03-04 20:33:00,063: DEBUG/MainProcess] beat: Synchronizing schedule...
  Mar 04 20:33:00 ip-xxx python[30931]: [2022-03-04 20:33:00,069: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:33:00 ip-xxx python[30931]: [2022-03-04 20:33:00,070: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;dcc342d
  Mar 04 20:33:00 ip-xxx python[30931]: [2022-03-04 20:33:00,071: DEBUG/MainProcess] beat: Waking up in 3.00 minutes.
  Mar 04 20:36:00 ip-xxx python[30931]: [2022-03-04 20:36:00,089: DEBUG/MainProcess] beat: Synchronizing schedule...
  Mar 04 20:36:00 ip-xxx python[30931]: [2022-03-04 20:36:00,096: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:36:00 ip-xxx python[30931]: [2022-03-04 20:36:00,097: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;0691a9a
  Mar 04 20:36:00 ip-xxx python[30931]: [2022-03-04 20:36:00,101: DEBUG/MainProcess] beat: Waking up in 3.00 minutes.
  Mar 04 20:39:00 ip-xxx python[30931]: [2022-03-04 20:39:00,001: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:39:00 ip-xxx python[30931]: [2022-03-04 20:39:00,002: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;d93ee48
  Mar 04 20:39:00 ip-xxx python[30931]: [2022-03-04 20:39:00,006: DEBUG/MainProcess] beat: Waking up in 59.99 seconds.
  Mar 04 20:39:59 ip-xxx python[30931]: [2022-03-04 20:39:59,998: DEBUG/MainProcess] beat: Synchronizing schedule...
  Mar 04 20:40:00 ip-xxx python[30931]: [2022-03-04 20:40:00,005: INFO/MainProcess] Scheduler: Sending due task generate_qrcode_existing
  Mar 04 20:40:00 ip-xxx python[30931]: [2022-03-04 20:40:00,006: DEBUG/MainProcess] crm.tasks.generate_qrcode_existing sent. id-&gt;9115ae
  Mar 04 20:40:00 ip-xxx python[30931]: [2022-03-04 20:40:00,008: DEBUG/MainProcess] beat: Waking up in 2.00 minutes.
  Mar 04 20:42:00 ip-xxx python[30931]: [2022-03-04 20:42:00,011: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:42:00 ip-xxx python[30931]: [2022-03-04 20:42:00,011: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;6e0b1d8
  Mar 04 20:42:00 ip-xxx python[30931]: [2022-03-04 20:42:00,013: DEBUG/MainProcess] beat: Waking up in 3.00 minutes.
  Mar 04 20:44:59 ip-xxx python[30931]: [2022-03-04 20:44:59,998: DEBUG/MainProcess] beat: Synchronizing schedule...
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,004: INFO/MainProcess] Scheduler: Sending due task Remind_if_job_timer_not_
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,005: DEBUG/MainProcess] crm.tasks.notify_unstopped_jobs sent. id-&gt;8d2b8dec-
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,007: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,008: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;684cf95
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,010: INFO/MainProcess] Scheduler: Sending due task Remind_if_job_timer_not_
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,010: DEBUG/MainProcess] crm.tasks.notify_unstarted_jobs sent. id-&gt;3cccac68-
  Mar 04 20:45:00 ip-xxx python[30931]: [2022-03-04 20:45:00,011: DEBUG/MainProcess] beat: Waking up in 3.00 minutes.
  Mar 04 20:48:00 ip-xxx python[30931]: [2022-03-04 20:48:00,001: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:48:00 ip-xxx python[30931]: [2022-03-04 20:48:00,001: DEBUG/MainProcess] beat: Synchronizing schedule...
  Mar 04 20:48:00 ip-xxx python[30931]: [2022-03-04 20:48:00,006: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;5410a44
  Mar 04 20:48:00 ip-xxx python[30931]: [2022-03-04 20:48:00,007: DEBUG/MainProcess] beat: Waking up in 2.00 minutes.
  Mar 04 20:50:00 ip-xxx python[30931]: [2022-03-04 20:50:00,000: INFO/MainProcess] Scheduler: Sending due task generate_qrcode_existing
  Mar 04 20:50:00 ip-xxx python[30931]: [2022-03-04 20:50:00,001: DEBUG/MainProcess] crm.tasks.generate_qrcode_existing sent. id-&gt;f78808
  Mar 04 20:50:00 ip-xxx python[30931]: [2022-03-04 20:50:00,002: DEBUG/MainProcess] beat: Waking up in 59.99 seconds.
  Mar 04 20:51:00 ip-xxx python[30931]: [2022-03-04 20:51:00,035: DEBUG/MainProcess] beat: Synchronizing schedule...
  Mar 04 20:51:00 ip-xxx python[30931]: [2022-03-04 20:51:00,041: INFO/MainProcess] Scheduler: Sending due task Scheduler_Test_Task (eve
  Mar 04 20:51:00 ip-xxx python[30931]: [2022-03-04 20:51:00,042: DEBUG/MainProcess] subscription.tasks.scheduler_test sent. id-&gt;c8229c0
  Mar 04 20:51:00 ip-xxx python[30931]: [2022-03-04 20:51:00,045: DEBUG/MainProcess] beat: Waking up in 3.00 minutes.
  lines 1-38
  </code></pre>
  <p>please help how i schedule tasks work fine in my production server</p>