본문 바로가기
Server/Linux

CentOS 7 부팅시 스크립트 실행하기

by kkumtree 2019. 10. 8.

개발 서버 부팅 시 tibero와 tomcat을 일일이 부팅시켜주는 것이 귀찮아져

부팅시 자동으로 부팅되도록 스크립트 작성

 

1. root 계정으로 로그인한다

 

2. cd /etc/rc.d/

 

3. vim rc.local

 

4. 원하는 명령어를 입력한다.

 

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

 

## User Script TIBERO, TOMCAT ##
su - tibero -c tbboot
su - tomcat -c /app/tomcat/apache-tomcat-7.0.92/bin/./startup.sh

touch /var/lock/subsys/local

 

~

~

~

 

 

 

 

 

****

su - tibero -c tbboot ( tibero라는 사용자로 로그인 후 tbboot 명령어로 tibero 부팅)

su - tomcat -c /app/tomcat/apache-tomcat-7.0.92/bin/./startup.sh ( tomcat이라는 사용자로 로그인 후 ./startup.sh 명령어로 tomcat 구동)

****

 

 

 

5. :wq로 저장 및 종료

'Server > Linux' 카테고리의 다른 글

linux (centOS 7) alias 영구 설정  (0) 2020.05.22
CentOS 7 - alias 지정하기  (0) 2019.10.08
리눅스 명령어 모음  (0) 2018.12.18