Just need to go through these articles:
Digitalocean has the greatest content!!
2. Here on more config options: https://stackoverflow.com/questions/27291448/supervisor-config-user-option-in-program-section
I wanted to run the script as a specific user, so in this case you just add to the /etc/supervisor/conf.d/<specific_file>.conf that has the supervisord options like:
- which command to run (a consumer sending emails)
- as which user (I want to run it as www-data)
- whether it should start when the system boots up (autostart)
- whether it should restart automatically (autorestart)
An example supervisor config:
[program:send_email_consumer] command=php /var/www/examprep/bin/console rabbitmq:consumer send_email_consumer autostart=true autorestart=true stderr_logfile=/var/log/send_email_consumer.err.log stdout_logfile=/var/log/send_email_consumer.out.log user=www-data