Closed Fivemeters closed 6 months ago
To achieve the behavior where a Spring Boot application runs in the background without printing logs to the console, without using nohup
, you can modify the startup script that executes the JAR file. Specifically, you can redirect the output to /dev/null
and run the process in the background. Here's how you can adjust the script:
./$SERVICE_NAME".jar" start > /dev/null 2>&1 &
This line does the following:
> /dev/null
discards the standard output (stdout).2>&1
redirects the standard error (stderr) to stdout, which is already being discarded.&
runs the process in the background.Additionally, within the Apollo repository, you can control logging behavior through configuration. For instance, setting the LOG_APPENDERS
environment variable to "FILE"
in the apollo-portal.conf
file directs the application to log only to a file, not to the console. This setup is part of how Apollo manages its logging and background execution behavior.
To continue the conversation, mention @dosu.
you may use vi to edit the ###.jar, and then you will some bash scripts.
you may use vi to edit the ###.jar, and then you will some bash scripts. 好的,我看下,谢谢
请问下shell脚本中的 ./###.jar start 这种启动方式,我看spring boot启动的时候日志不会打印到控制台,后台在运行,也没有加nohup命令,这个是怎么做到的,是怎么配置的。