Reload Ngnix from .py file

Hello all,
I want to reload nginx server from .py file
by python subprocess model.
I also try

subprocess.Popen(['service nginx reload'], shell=True, stdout=subprocess.PIPE)

this work but need given password for every time run.
I want run my production server so there have no chance to give password.
I can also do by

os.system('echo %s|sudo -S %s' % ('password', 'service nginx reload'))

for run this commend I need to know Ubuntu user " frappe's " password.

So please tell me any good processing way OR where can I get "frappe's" password.



Please check the bench setup reload-nginx command. You can find the reload_nginx py method in

Thanks, Makarand

1 Like

This is more of a linux question than ERPNext. I think you can add your user to sudoers file and it will not ask for password.

1 Like