For may administrative tasks it is necessary to restart or shut down a service. Mostly it is for Apache2 and MySQL.
In some cases it is necessary to completely shut down the service and deny restart. This guide describes basic tasks for management of running services on the server. For that you need to have access to command terminal of the server.
CHECKING SERVICE STATUS ON THE SERVER
For managing service statuses in OS Ubuntu serves a tool service. If we need to find out if the desired service is active, we will use service in a form:
service apache2 status

MANAGEMENT OF RUNNING SERVICE ON THE SERVER
List of possible operations, that we can call with a command service, can be retrieved by entering on the command itself for example:
service apache2
will return:
Usage: apache2 {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean}
for Apache2 there are many actions, in practice we use mostly restart and reload.
In most of the cases when you need to apply the new configuration call:
service apache2 reload
V takomto prípade nedojde k ukončeniu prebiehajúcich spojení a návstevníci stránky si reštart ani nevšimnú.
PERMANENT SHUTDOWN OF THE SERVICE
If you need for a service not to be active after shutdown, you can achieve that by adding configuration file to the services in a directory init.
echo manual | tee /etc/init/SERVICE.override
In the directory /etc/init/ there are running scripts for services. If there is a file .override, it will be used instead of the original script.
For example if you would need to shut down MySQL, you would run:
echo manual | tee /etc/init/mysql.override
Deleting the file will reverse all to the original state:
rm /etc/init/mysql.override
After the next restart the service will be run automatically