Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

脚本启动与停止的问题 #5142

Closed
Fivemeters opened this issue May 13, 2024 · 3 comments
Closed

脚本启动与停止的问题 #5142

Fivemeters opened this issue May 13, 2024 · 3 comments

Comments

@Fivemeters
Copy link

请问下shell脚本中的 ./###.jar start 这种启动方式,我看spring boot启动的时候日志不会打印到控制台,后台在运行,也没有加nohup命令,这个是怎么做到的,是怎么配置的。

Copy link

dosubot bot commented May 13, 2024

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.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@nobodyiam
Copy link
Member

you may use vi to edit the ###.jar, and then you will some bash scripts.

@Fivemeters
Copy link
Author

you may use vi to edit the ###.jar, and then you will some bash scripts.
好的,我看下,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants