[CentOS 7] 서비스 실행 systemctl

안녕하세요? WEBPD.NET 서버운영팀입니다.

systemctl  명령어는  CentOS 7 부터 사용 가능합니다.

 CentOS 6.x 에서 실행하면 이렇게 사용할 수 없다는 메시지만 뜹니다.

 

 [root@localhost /]# systemctl

 bash: systemctl: command not found

 

 서비스 상태 확인 하기

 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 enable service_name.service

 

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

systemctl enable httpd.service

 

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

 

실행 중인 서비스 보기

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

systemctl list-units --type=service

 

실행 중인 모든 서비스 목록을 본후 q 를 누르면 빠져나갈수 있습니다.

 

관련내용

https://www.centos.org/forums/viewtopic.php?t=50862 

https://www.cmsfactory.net/node/10299 

이 답변이 도움이 되었습니까? 1 명의 사용자가 추천했습니다. (1 추천)