Production mode and supervisor problem

Hi all,
i have a problem with supervisor. after i install it and when i type “bench restart” the output was as here:
root@ERPNEXT-DEMO:/home/frappe/frappe-bench# bench restart
[sudo] password for frappe:
Sorry, user frappe is not allowed to execute ‘/usr/bin/supervisorctl status’ as root on ERPNEXT-DEMO.localdomain.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/utils.py”, line 19, in restart
restart_supervisor_processes(bench_path=’.’, web_workers=web)
File “/home/frappe/.bench/bench/utils.py”, line 337, in restart_supervisor_processes
supervisor_status = subprocess.check_output([‘sudo’, ‘supervisorctl’, ‘status’], cwd=bench_path)
File “/usr/lib/python2.7/subprocess.py”, line 574, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command ‘[‘sudo’, ‘supervisorctl’, ‘status’]’ returned non-zero exit status 1
root@ERPNEXT-DEMO:/home/frappe/frappe-bench# bench restart
[sudo] password for frappe:
Sorry, user frappe is not allowed to execute ‘/usr/bin/supervisorctl status’ as root on ERPNEXT-DEMO.localdomain.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/utils.py”, line 19, in restart
restart_supervisor_processes(bench_path=’.’, web_workers=web)
File “/home/frappe/.bench/bench/utils.py”, line 337, in restart_supervisor_processes
supervisor_status = subprocess.check_output([‘sudo’, ‘supervisorctl’, ‘status’], cwd=bench_path)
File “/usr/lib/python2.7/subprocess.py”, line 574, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command ‘[‘sudo’, ‘supervisorctl’, ‘status’]’ returned non-zero exit status 1

how can i solve it?

I think you should use a non-root user to run that command. Try logging in with the frappe user.

1 Like

i solved it
thank u @yefritavarez

Sorry to jump in on this subject but I am experiencing the same issue and I can’t seem to find a fix to it.

@MaysaaSafadi can you please detail the fix you got ?

Thank you in advance.