springboot project building non-stop server on AWS EC2

Viewed 110

I made java springboot project for the first time. SO need some advice.

I used gradle, war.

I git-pushed my project on AWS EC2. and run java -jar filename.war which succeeded data communication with frontend. But when I leave the terminal with ctrl +c , the java server stops.

Which way is the best to build non-stop server like Node pm2?

In my EC2 virtual machine, there are several projects and I use NginX to route each projects to different port numbers.

Thanks in advance!

1 Answers

Linux

You can use nohup:

nohup java -jar -Djava.awt.headless=true your_server.war > /path/log.out &

Later you can use:

ps aux // to get the $PID of your process
kill -9 $PID // to kill the process

Windows

Please check this answer

Related