Reputation: 1050
I have to run my script (which is Flask server), as well as the Celery worker in order for my application to work with two commands:
python3 my_application.py
celery -A my_application.celery worker
I want this to run on my Ubuntu VM in the background and also start again automatically when the machine has restarted.
How can I achieve this?
Thanks.
Upvotes: 0
Views: 303
Reputation: 19787
The best approach is to make two Linux services. One for your Flask-based service, and the other for Celery. Celery has a whole section in the documentation - Daemonization - to explain the ways to do exactly what you want. Most modern Linux distributions (Ubuntu included) use systemd, so I recommend getting familiar with it.
Upvotes: 1