Linux

RHEL7.x - rc.local 활성화

기억보다는 기록을... 2021. 12. 6. 14:14

RHEL7.x 버전우 경우 rc.local 서비스가 기본적으로 비활성화 되어 있어

rc.local 에 명령어를 입력해도 리부팅 시 실행 되지가 않음.

 

/etc/rc.local 파일을 확인 해 보면 'chmod +x /etc/rc.d/rc.local' 권한을 추가해야 된다고 나옴

 

 

1. /etc/rc.d/rc.local 권한 추가

   # chmod +x /etc/rc.d/rc.local

 

 

2. rc.local 서비스 상태 확인

   # systemctl status rc-local

Active: inactive (dead) 상태로 비활성화 되어 있음

 

 

3. rc.local 서비스 활성화를 위해 rc-local.service 파일에 Install 섹션 설정

   # vi /usr/lib/systemd/system/rc-local.service 파일에 아래 내용 추가

 >> 설정 전

   # systemctl list-unit-files | grep rc-local

>> 설정 후

   # systemctl list-unit-files | grep rc-local

 

4. rc.local 서비스 가동 및 상태 확인

   # systemctl start rc-local

   # systemctl status rc-local

서비스 상태가 enabled-runtime 으로 표기 됨

 

5. 리부팅 시 서비스 활성화를 위해 enable 설정 및 가동 상태 확인

   # systemctl enable rc-local

   # systemctl status rc-local

   # systemctl list-unit-files | grep rc-local

서비스 상태가 enabled 로 표기 됨