简体   繁体   中英

Booting Java Application On Startup - Raspberry Pi - Raspbian - Shell Script

I've been attempting to boot a java application via a shell script on a Raspberry Pi 2 startup for a while now with absolutely no success. I've been through countless threads and tutorials with no joy.

I'm running a java application via a shell script.

rc.local

I've tried putting a reference to the shell script in the etc/rc.local file. I've had the application in the usr/local directory and i've also tried moving it to the home/pi folder. All permissions are set to full on every file.

su - pi -c "bash /home/pi/logon.sh &"

Has no effect on boot, the shell script runs fine when you run it from the terminal.

Chrontab

I've edited the chrontab file. I've tried multiple variants on the end of this file, again nothing worked on boot.

etc/init.d

I've also placed the shell script in this folder and ran the command: sudo update-rc.d /etc/init.d/logon.sh defaults. There are no complaints, it seems to work, shell script works when executed manually, however nothing starts up on boot.

I'm assuming that either Java isn't initiated at the point of boot or the shell script attempts to run before Raspbian boots into its interface since non of the above methods work. I don't mind losing the Raspbian interface if neccessary, in fact this would be preferable. I simply want a java application to start up when the Raspberry Pi boots. Any ideas?

Thanks

i've done it with this wrapper : https://stackoverflow.com/a/21283530/5066919

and you'll see that he use the " nohup " (no hang up) command, like this the app don't close when the user log out

Also becarefull if you use " scanner.hasNext() " command : https://stackoverflow.com/a/33456615/5066919

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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