I have a program which is supposed to always be running. This program listens for commands in a message broker, does a file system operation upon request, and publishes the result through the same broker. In order to access the files, it needs to run as the user scicat. To ensure that the program is always running, I installed supervisord and ran the program through it.

The program starts and listens properly, but when it's time for the file system operation, it encounters permission errors. However, if I do sudo su - scicat and run it through the shell, the program works as intended.

This is how the service is defined in supervisord:

command=/opt/exp-lc/venvs/biomax-file-size-helper/bin/python /opt/exp-lc/biomax-file-size-helper/main.py

If I run both programs alongside – one working and one not – and do ps aux, I see the following:

scicat   29867  0.2  0.4 124640 19444 ?        Sl   15:44   0:03 /opt/exp-lc/venvs/biomax-file-size-helper/bin/python /opt/exp-lc/biomax-file-size-helper/main.py
scicat   30012  2.8  0.4 124096 19668 pts/0    Sl+  16:07   0:00 /opt/exp-lc/venvs/biomax-file-size-helper/bin/python /opt/exp-lc/biomax-file-size-helper/main.py

I.e. two more or less identical processes in any relevant regard. What is it that makes the program unable to access files when run through supervisord, but not when run in the shell?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.