I have a program, that runs on only one Raspberry Pi, but could be run from multiple other computers (through SSH).
When I run my program on the Pi, it runs as expected.
To be able to run from crontab or SSH, I created (ok, scissored together) some bash scripts, however, it is not running as intended.
The first was like this:
exec sudo /usr/bin/java \ -Djava.library.path=/usr/lib/jni \ -cp /usr/share/java/RXTXcomm.jar \ -jar '/home/pi/forgokapu/dist/forgokapu.jar' < /dev/tty1
However, it did not allow to read from the Pi's
tty1. (I think that & means to run in the background).
However, even without the
&, it gives the output to the computer it's run from (
pts/0), but doesn't take input from anywhere. I tried to add
exec sudo /usr/bin/java \ -Djava.library.path=/usr/lib/jni \ -cp /usr/share/java/RXTXcomm.jar \ -jar '/home/pi/forgokapu/dist/forgokapu.jar' < /dev/tty1 >/dev/tty1
to force both input and output to the
tty1, but now the output does not appear anywhere, and
ps -A shows it is running on
< /dev/tty1 is inside the script, but the program still runs on
pts/0 (or crontab), and not taking input from it's
tty1. Bash does.
520 tty1 00:00:00 login 690 tty1 00:00:01 bash 917 pts/0 00:00:00 bash 1221 pts/0 00:00:00 sudo 1227 pts/0 00:00:00 java 1241 pts/0 00:00:00 ps
</dev/tty1 does not redirect java to
How can I force the program to take input from the
I don't need bash, so it should run in the foreground. Redirection of output is not important, but I would have from the origin of the program start for debugging purposes.
I also tried
0</dev/tty1, but the input is still from
I also tried
setsid sh -c 'exec sudo /usr/bin/java \ -Djava.library.path=/usr/lib/jni \ -cp /usr/share/java/RXTXcomm.jar \ -jar "/home/pi/forgokapu/dist/forgokapu.jar" <> /dev/tty1 >&0 2>&1'
from Start a process on a different tty, but it's still not working. :'(
script is also no good, I need the opposite of what it does.