I am developing a Java program which checks the running processes, if not start that process. In my context I am executing the .sh file which is like this.
#!/bin/sh
echo "Hello World..."
cnt=`ps -eaflc --sort stime | grep clientApplication.jar | grep -v grep | wc -l`
if [ $cnt = 3 ]
then
echo "Services for Pigeon are already running..."
else
echo "Starting Services for Pigeon..."
echo `java -jar clientApplication.jar`
fi
But it's not working. What's the problem?