[Ubuntu] rc.local

2021. 7. 27. 14:19OS/Ubuntu

우분투를 설치하면 rc.local 이 없다. 

찾아보니 추가를 해줘야 된다고 하네

① 파일생성

/etc/rc.local

#!/bin/bash
exit 0

 

② 실행파일로 변경

sudo chmod +x /etc/rc.local

③ 서비스 생성

/lib/systemd/system/rc-local.service 파일 열기

붉은 색 부분 추가

[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
[Install]
WantedBy=multi-user.target

④ rc-local 활성화

systemctl enable rc-local.service

⑤ 실행 / 중지

systemctl start/stop rc-local.service

⑥ 상태확인

systemctl status rc-local.service

/etc/rc.local

#!/bin/bash
exit 0

② 실행파일로 변경

sudo chmod +x /etc/rc.local

③ 서비스 생성

/lib/systemd/system/rc-local.service 파일 열기

붉은 색 부분 추가

[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
[Install]
WantedBy=multi-user.target

④ rc-local 활성화

systemctl enable rc-local.service

⑤ 실행 / 중지

systemctl start/stop rc-local.service

⑥ 상태확인

systemctl status rc-local.service

 

'OS > Ubuntu' 카테고리의 다른 글

[Ubuntu] Run Level 수정  (0) 2021.07.15
[Ubuntu] 로그인 실패로 제한 걸린거 풀기  (0) 2021.07.15
[Ubuntu] Console에서 로그인 안되고 SSH 로그인 되는 문제  (0) 2021.07.15
[Ubuntu] 메모리  (0) 2018.01.22
[Ubuntu]자동실행  (0) 2017.12.13