Hello,
Please i want to insert this code in a java program because i need to call a java function inside the while:
Please how can i do?
thank you so much
Hello,
Please i want to insert this code in a java program because i need to call a java function inside the while:
Please how can i do?
thank you so much
What do you mean with "java function" ? A method or an application ?
In any case, if you code in java, better doing everything in java instead of trying mixing it with shell scripting.
yes, it's a java method
I would like to insert linux commands in the java code because I have a library that I can use it only through the linux command (cmd1,cmd2)
cmd1,cmd2 generate files ,I have to store them using java methods
Thank you for help
I think it would make more sense to create a list of files for java to use once, and have a loop inside java itself process them, for two reasons:
1) You can't really embed java inside bash like that
2) Running, loading, and quitting java 9,000 times to process 9,000 files will be immensely wasteful.
is this possible in my case? I explain my problem again
i use the bib of checkpoint BLCR
cmd1 my_program & my_pid=$! //cmd 1 of the library --> let me to run my_program: process that i want to checkpoint (cmd1=cr-run)
while cr-checkpoint $my_pid //cmd2 of the library: generate file of checkpoint
do
sleep 60
//call a java method : store file
done
//the while let me to checkpoint my_program every 6 seconds
You cannot call a java method from a shell script, only a java application.
Use java instead of a shell script to do your loop.
yes i'd like to use java instead of a shell script to do the loop.
So I have to call Runtime.exec for the first command
but I did not understand how to do for the second command since it's a condition in the loop, in addition it must take as parameter the pid of the process running..
Thank you for help
Use a wrapper that launch cmd1 in the background then prints its pid. Get the pid from the the process outputStream.
Please can you explain your idea a little further
I don't know this concept of wrapper, I wonder if you could clarify a bit your idea
thank you very much
#!/bin/sh
cmd1 &
echo $!