ec2 shell script execute when boot
웹서버를 설치한 ec2 인스턴스에서 인스턴스를 시작할때마다.
매번 웹서버 프로세스를 기동해줘야 했다. -_- 귀찮..
/etc/rc.local 파일은 리눅스가 부팅된후 마지막 시점에 호출되어 실행된다.
아래와 같이 nginx 실행과 tomcat start를 작성하면
linux 부팅시 호출되어진다.
( rc.local의 실행 유저는 root 이다.)
# nginx start
su -c nginx# war deploy tomcat start
su - tomcat '/home/tomcat/shell/war-deploy.sh'
다른 방법으로
ec2 aws console 에서도 적용할수 있다.
instace 메뉴의 Action -> instance Settings -> View/Change User Data 메뉴에서 가능하다.
(인스턴스 중지된 상태에서 수정이 가능하다.)
자세한 내용은 아래 doc에서.
https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts