본문 바로가기
Ubuntu

ubuntu 에서 rc.local 사용하기

by freesunny 2019. 11. 21.

* ubuntu 18.04 를 기준으로 작성되었습니다.

 

ubuntu 에서 rc.local 를 사용할 수 있는 방법입니다. (기본적으로 비활성되어 있습니다.)

 

root 권한 획득

$ sudo su -

 

 

/etc/rc.local 파일 생성

printf '%s\n' \
'#!/bin/bash' \
'#' \
'# rc.local' \
'#'\
'# This script is executed at the end of each multiuser runlevel.' \
'# Make sure that the script will "exit 0" on success or any other' \
'# value on error.' \
'#' \
'# In order to enable or disable this script just change the execution' \
'# bits.' \
'#' \
'# By default this script does nothing.' \
'' \
'' \
'exit 0' | sudo tee -a /etc/rc.local

 

 

rc.local 파일 실행권한 부여

chmod +x /etc/rc.local

 

 

rc-local.service  설정 변경

mkdir /etc/systemd/system/rc-local.service.d
echo "[Install]" >> /etc/systemd/system/rc-local.service.d/override.conf
echo "WantedBy=multi-user.target" >> /etc/systemd/system/rc-local.service.d/override.conf

 

rc-local.service 활성화

systemctl enable rc-local.service

 

 

rc-local.service 실행

systemctl start rc-local.service
 

 

rc-local.service 상태확인

systemctl status rc-local.service
 

'Ubuntu' 카테고리의 다른 글

Zabbix 4 Agent 설치 - Ubuntu 14.04  (0) 2019.07.12
Zabbix 4 Agent 설치 - Ubuntu 16.04  (0) 2019.07.12
Zabbix 4 Agent 설치 - Ubuntu 18.04  (0) 2019.07.12
디스크 UUID, LABEL 확인  (0) 2019.07.12
라우팅테이블 추가  (0) 2018.04.26