Portal Home > Knowledgebase > Articles Database > Apache restart
Apache restart
Posted by Dheeraj Moolya, 06-03-2011, 08:08 AM |
What will be the script for restarting the apache server in non business hours with SUDO.
|
Posted by cptechie, 06-03-2011, 08:17 AM |
Hello,
You can restart apache using the below given commands :
>> service httpd restart
>> /etc/init.d/httpd restart
If you are using cpanel you can use :
/scripts/restartsrv_httpd
Last edited by cptechie; 06-03-2011 at 08:21 AM.
Reason: Added Info
|
Posted by Dheeraj Moolya, 06-03-2011, 08:29 AM |
Actually I want to do it through Sudo ... and want to take the password automatically ...thats y i want a script that can do it automatically and I will schedule that in crontab on non-business hours.
|
Posted by lynxus, 06-03-2011, 08:33 AM |
just do it in the roots crontab?
That way you dont need a password
|
Posted by Dheeraj Moolya, 06-03-2011, 08:34 AM |
Actually I don't have the root access, I only have the sudo access.
|
Posted by Lincxu, 06-03-2011, 08:46 AM |
sudo /etc/init.d/httpd restart
|
Posted by net, 06-03-2011, 08:49 AM |
Moved > Hosting Security and Technology.
|
Posted by Dheeraj Moolya, 06-03-2011, 11:32 AM |
I want to implement this in a script so that it will automatically take the password and do the restart.
|
Posted by viGeek, 06-03-2011, 12:20 PM |
There is an option (NOPASSWD?) so that the sudo user does not have to enter a password, I would only do something like this if you're restricting that user to only be able to execute the apache restart script.
Another option is setting a stickybit on the script itself, but a bit less secure.
|
Posted by DewlanceHosting, 06-03-2011, 02:07 PM |
You can use cronjob.. and also check this small tutorial:
Configuring sudo to work without password: http://www.readmespot.com/question/f...thout-password
|
Posted by Dheeraj Moolya, 06-03-2011, 02:52 PM |
Can't I make a script to work with sudo and automatically take the password which is entered over there.
|
Add to Favourites Print this Article
Also Read
I need help! (Views: 626)