A single computer may have a lot of service running in the background, for example on my lubuntu i have apache web server, mysql database server, and php fpm running in the background, these are services. So how do i start and stop these services?
Lucky for us lubuntu users, lubuntu/ubuntu have special command line tool for starting, stopping, and restarting a service, it's also possible to get the status of the service. The tool for managing services is called service and this tool need to run under root permission.
1. Showing status of all services
service --status-all
2. How to stop a running service
sudo service [service-name] stop
Example
sudo service mysql stop
sudo service apache stop
3. How to start a service
sudo service [service-name] start
Example
sudo service apache start
sudo service nginx start
4. How to restart a service
sudo service [service-name] restart
or
sudo service [service-name] reload
Example
sudo service nginx reload
sudo service nginx restart
sudo service mysql restart
5. How to show status of a service
sudo service [service-name] status
Example
sudo service apache status
sudo service mysql status
The service command also have other parameters that might be useful for you:
- force-reload
- configtest
- rotate
- upgrade
0 comments:
Post a Comment