Blog Pages

Linux – start, stop and check status of a service

Start a service: (in this example, service name is mysql)

Myuser@MyLinuxServer:~$ sudo service mysql start

Myuser@MyLinuxServer:~$


See service status: (in this example, service name is mysql)

Myuser@MyLinuxServer:~$ sudo service mysql status

● mysql.service - MySQL Community Server

   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)

   Active: active (running) since Sun 2020-12-20 15:19:08 UTC; 8s ago

  Process: 8358 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)

  Process: 8333 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)

 Main PID: 8360 (mysqld)

    Tasks: 33 (limit: 4915)

   CGroup: /system.slice/mysql.service

           └─8360 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid


Dec 20 15:19:07 MySQL systemd[1]: Starting MySQL Community Server...

Dec 20 15:19:08 MySQL systemd[1]: Started MySQL Community Server.

Myuser@MyLinuxServer:~$


Stop a service: (in this example, service name is mysql)

Myuser@MyLinuxServer:~$ sudo service mysql stop

Myuser@MyLinuxServer:~$

No comments:

Post a Comment