I have a shell script that I am running every 60 seconds, but it is creating this process to the point that it is causing the server to perfrom poorly. Below is my script, what can I change to prevent this?
while true
do
java -classpath .....( all my classes here)
>/dev/null 2>&1
sleep 60
done
my java code is getting a list of work from web services, and based on that list runs a command to make files available to a user that requests it. If I run just the java code from command line, it runs once and then dies...a process that I repeated about 20 times from command line just to make sure I am not scheduling anything within the java.
So, I understand that process is not finishing before those 60 secs pass... I think that's the problem.
For instance, if you want it to be executed just 60 secs after it finishes, try something like:
while true; do
java -classpath .....( all my classes here) >/dev/null 2>&1 && sleep 60
done
But be careful with this kind of loops. In this case, if the exit code of that java is not 0, the next execution would be inmediate.