简体   繁体   English

在嵌入式Linux上启动后自动在后台启动Java应用程序

[英]Start java application in background automatically after boot on embedded linux

I am using an embedded linux ( Distro: TI SITARA SDK 6.0.0 ) on beaglebone black. 我在beaglebone黑色上使用的是嵌入式Linux(发行版:TI SITARA SDK 6.0.0)。 I have a java application which runs multiple tcp servers. 我有一个运行多个TCP服务器的Java应用程序。 I need to start this application in background and automatically after every boot. 我需要在后台启动该应用程序,并在每次启动后自动启动。 If i login with ssh and run the below code manually (or in bash script) it does work. 如果我使用ssh登录并手动(或在bash脚本中)运行以下代码,它将起作用。

nohup java -jar application.jar &>log.txt &

But if i add this in linux init script and reboot it doesn't. 但是,如果我在linux初始化脚本中添加它,然后重新启动,则不会。 If i delete last '&' in the line it does work but system resets after 2-3 minutes. 如果我删除该行中的最后一个“&”,它确实起作用,但是系统会在2-3分钟后重置。

So how can i start my application after every bootup and not causing a reset ? 那么,如何在每次启动后启动我的应用程序而不引起重置?

I solve this problem with starting my device's watchdog like application in my script. 我通过在脚本中启动设备的看门狗程序来解决此问题。 My application works in background but bash scripts stays open until my application stops. 我的应用程序在后台运行,但是bash脚本保持打开状态,直到我的应用程序停止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM