This question already has an answer here:
I am trying to run a java program inside a screen session at boot, I am using the following cron, but after reboot screen -ls shows no active screen sessions.
@reboot /usr/bin/screen -dmS myservice "java -jar /home/david/myservice/MyService-0.0.1-SNAPSHOT.jar"
Any idea what I am doing wrong?
I did change it to the following and the screen does start at boot now.
@reboot /usr/bin/screen -dmS myservice && "java -jar /home/david/myservice/MyService-0.0.1-SNAPSHOT.jar"
&& before starting the java command and not the screen does start at boot. But the program is still not running.
but the program is not running when I attach to the screen. after attaching to the screen all I see is a dollar sign.