If you are ubuntu newbie, you probably didn't know how to start, stop, and restart a service on ubuntu, plus how to see the status of the service itself. Don't worry, i'm here to help you with that.
There is a command line tool for start, stop, restart, and also showing
the status of a service, the tool is called 'service' and you need to
run it with 'sudo' command.
A service is a program that runs on the background process (people also
called it 'daemon'), for example apache web server, nginx web server,
mysql database server, elasticsearch server, and so on.
How to start a service on ubuntu
sudo service [name] start
sudo service mysql start
sudo service apache2 start
How to stop a service on ubuntu
sudo service [name] stop
sudo service mysql stop
sudo service apache2 stop
How to restart a service on ubuntu
sudo service [name] restart
sudo service msyql restart
sudo service apache2 restart
How to show status of service on ubuntu
sudo service [name] status
sudo service mysql status
sudo service apache2 status
Alternatively, you can also call directly the binary of the service/daemon itself, which usually stored on /etc/init.d/, this is what people used to do back in the old days.
sudo /etc/init.d/mysql start
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql restart
sudo /etc/init.d/mysql status
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.