I made small java app for logging users by ID. It reads input using System.in.read() in loop and on Enter key it saves readed string to log file with actual date and time as a new line (it´s designed for use with RFID reader). Each readed symbol is also printed to stdout prefixed with "Readed: "
App works fine when is started by command java -jar app.jar.
I want to start this app automatically after system boot so I add start script into /etc/init.d/
And there is a problem. App is started, but it runs on background. When I redirect stdout to file via java -jar app.jar >> log.txt in start script, after reboot and open log file there are many lines with string "Readed: " folowed by non-ascii character, and lines count is growing by a thousands every minute.
I am not able to redirect standard input into this app.
Is there any possibility how to automatically run command in default console(with standard input/output from/to console) when system boots in command-line mode (without GUI)?
I very appreciate any help or advice.