Directory setting in Supervisor

supervisord

I was configuring supervisor daemon to be able to start/stop Celery.

It did not work. After debuging back and forth I realized that the problem was that it did not change the working directory to the one mentioned in the directory option in supervisord.conf under program section.

Hopefully there is a workdir in Celery but I am curious – what is the purpose of the directory option then?

If you run a script via supervisor and print pwd it will output /.

Best Answer

I had the same problem and managed to resolve it by reversing the order of directory and command options:

e.g. working:

[program:cat]
directory=/var/log
command=cat logfile

NOT working:

[program:cat]
command=cat logfile
directory=/var/log