[우분투18.04 에서 rc.local 파일 사용하기]
OS : Ubuntu 18.04 LTS
rc.local 파일생성
$ sudo cat >> /etc/rc.local <<EOF
#!/bin/bash
exit 0
EOF
실행 권한부여
$ sudo chmod +x /etc/rc.local
파일 내용 추가
$ cat /lib/systemd/system/rc-local.service
...........................
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
(아래 두줄 추가 하기)
[Install]
WantedBy=multi-user.target
rc-local 서비스 활성화
$ sudo systemctl enable rc-local.service
Created symlink /etc/systemd/system/multi-user.target.wants/rc-local.service -> /lib/systemd/system/rc-local.service.
$ sudo systemctl start rc-local.service
$ sudo systemctl status rc-local.service
rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/rc-local.service.d
└─debian.conf
Active: active (exited) since Mon 2019-10-22
Docs: man:systemd-rc-local-generator(8)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/rc-local.service