티스토리 뷰
참고 : https://wiki.debianusers.or.kr/index.php?title=Update-rc.d
/etc/init.d/ 아래 작성되는 스크립트는 리눅스 부팅시 서비스가 자동으로 시작 되도록 하기 위해 작성하는 스크립트.
root@freecatz-web:~# cd /etc/init.d/
root@freecatz-web:~# vi testService
### BEGIN INIT INFO # Provides: <스크립트 파일 이름> # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: this is short description # Description: this is description ### END INIT INFO # 여기서 부터는 쉘스크립트 처럼 사용 하면 된다. case "$1" in start) ;; stop) ;; restart) ;; esac exit 0 |
Required-Start, Required-Stop 는 해당 서비스가 실행뒤 실행 하거나 종료 하라는 것 인듯 하다.
작성한 스크립트의 권한을 변경하여 준다.
root@freecatz-web:~# chmod 755 testService
위와 같이 스크립트를 작성 하고 아래의 명령을 입력 한다.
root@freecatz-web:~# update-rc.d testService defaults
root@freecatz-web:~# chkconfig --add testService
서비스가 올라가는 순서를 제어 하고 싶다면 defaults 뒤에 숫자를 입력 한다.
root@freecatz-web:~# update-rc.d testService defaults 99
숫자가 높을 수록 지연되어 서비스가 올라 간다.
root@freecatz-web:~# chkconfig --list | grep -i testService
등록된 서비스를 삭제 하고자 한다면 아래와 같은 명령을 실행 한다.
root@freecatz-web:~# update-rc.d -f testService remove
root@freecatz-web:~# chkconfig --del testService
- Total
- Today
- Yesterday
- Review
- food
- Android
- springboot
- devel
- dart
- json parse
- development
- SSL
- Spring
- gpkiapi
- JavaScript
- HTTP
- devtools
- Java
- 엘리스센터
- ssh
- 맛집
- MySQL
- Security
- Linux
- Mobile
- web
- Flutter
- kotlin
- Compile
- place
- Fun
- TIP
- samba
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |