I need to make a java program, when the user enters 0, he should exit. no problems with writing in java code.
int cmd = read();
System.out.println("got command : " + cmd);
if (cmd == 48) {
System.exit(0);
I want to start this process using start-stop script in linux. I can also do this using &ornohup
case "$1" in
'start')
if [ -f myfifo ]; then
rm myfifo
fi
mkfifo myfifo
cat > myfifo &
echo $! > myfifo-cat-pid
java -jar myjar.jar >/dev/null 2>&1 0<myfifo &
echo "Started process: "$!
;;
'stop')
echo 0 > myfifo
echo "Stopped process: "
rm myfifo
;;
esac
My problem is - as soon as I started this process, it read input -1. While I want to read from stdinput when somthing echoes it explicitly, that is, it calls. I just need a program that will be closed by the shell script explicitly. I tried very hard. Help me.
Edit:
, q . , , , . . Jnotify, , . , , SunOS.: (