systemctl 명령어 사용법

2015. 2. 7. 21:52IT/Linux

출처 : http://hmjkor.tistory.com/330


Fedora 21에서는 서비스(Service) 관리를 systemctl이라는 명령어로 한다.(chkconfig, ntsysv, servce 같은 명령어는 더이상 사용하지 않는다.)


서비스 상태 확인 하기

서비스 상태 확인은 다음과 같이 한다.

systemctl status service_name.service

예를 들어 httpd의 상태를 확인하려면 다음과 같이 명령한다.

systemctl status httpd.service


서비스 시작, 중지, 재시작 하기

서비스를 시작하는 기본 명령 방식은 다음과 같다.

systemctl start service_name.service

중지할 때에는 start 대신 stop을, 재시작할 때에는 restart를 쓰면 된다. 예를 들어 httpd를 시작하려면 다음과 같이 명령한다.

systemctl start httpd.service


중지와 재시작은 다음과 같이 명령하면 된다.

systemctl stop httpd.service
systemctl restart httpd.service
systemctl start httpd.service
systemctl start vsftpd@vsftpd.service


부팅 시 자동 실행 하기

시스템 부팅 시 서비스가 자동 실행되게 하는 명령은 다음과 같다.

systemctl enable service_name.service

예를 들어 httpd를 부팅 시 자동 실행되게 하려면 다음과 같이 명령한다.

systemctl enable httpd.service

자동 실행 되지 않게 하려면 enable 대신 disable을 쓰면 된다.


실행 중인 서비스 보기

실행 중인 모든 서비스 목록을 보려면 다음과 같이 명령한다.

systemctl list-units --type=service