The personal website of web developer.

systemctl - service startup on CentOS 7 or Fedora/RHL

Description

Useful systemctl commands to manage services and system via systemctl, Applicable in all fedora versions like Fedora 17, 16, 15, etc., or CentOS 7 .

Snippet code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Start a service via systemctl
[root@server ~#]systemctl start <daemon>.service
Note:for example to start squid use:  systemctl start squid.service


To Stop a service
[root@server ~#]systemctl stop <daemon>.service


Restart a service
[root@server ~#]systemctl restart <daemon>.service


Reload a service
[root@server ~#]systemctl reload <daemon>.service


Status of a service
[root@server ~#]systemctl status <daemon>.service


Display all service/daemon status
[root@server ~#]systemctl -a                (type "q" for quit)


Add a service to startup
[root@server ~#]systemctl enable <daemon>.service


Remove a service from startup
[root@server ~#]systemctl disable <daemon>.service


Shutdown and halt the system
[root@server ~#]systemctl halt


Shutdown and poweroff the system
[root@server ~#]systemctl poweroff


Shutdown and reboot the system
[root@server ~#]systemctl reboot