0

My goal is to run sudo inside one of the programs:

[program:doStaff]
command=sudo python manage.py doStaff
autostart=true
autorestart=true
stderr_logfile=/var/log/doStaff.err.log
stdout_logfile=/var/log/doStaff.out.log

Here is [unix_http_server] from supervisord.conf:

[unix_http_server]
file=/var/run/supervisor.sock  
chmod=0770   

Tried to set the supervisord user to root inside supervisord.conf but it didn't help.

I am trying to run this process as root since this script deletes some files in the system.

guystart
  • 1
  • 1
  • 1

2 Answers2

1

In your program config (program:doStaff) add this line:

user=root
afwanwh
  • 11
  • 2
0

You should setup passwordless sudo for a user and run your script as that user.

Edit sudoers file first :

sudo visudo

At the end of that file add:

scriptrunner ALL=(ALL) NOPASSWD:ALL

Now run your script as scriptrunner user. You have to create that user of course.

Tutul
  • 892
  • 6
  • 20