MxMave
MxMave

Reputation: 75

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

Upvotes: 0

Views: 1773

Answers (1)

DFaze
DFaze

Reputation: 21

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

Upvotes: 1

Related Questions