Reputation: 17382
I want to reload my apache server using a Python script. What will that be?
I know the terminal command , ie
sudo /etc/init.d/apache2 reload
This is what I tried:-
import os
c = "sudo /etc/init.d/apache2 reload"
os.system(c)
says sudo: no tty present and no askpass program specified
How can I reload my server ?
Upvotes: 2
Views: 851
Reputation: 29557
2021 here. I could use sudo, even with vanilla apache2 installation.
import os
c = "sudo service apache2 restart"
os.system(c)
Upvotes: 0
Reputation: 17382
Removed sudo
and tried, it worked
import os
c = "/etc/init.d/apache2 reload"
os.system(c)
Upvotes: 2