I am trying to create a script that monitors a java runtime process,which makes use of a Virgo service. It should start the process when its not running. As there is no specific service name, i was thinking of grepping the name of the process and use it as an identifier.
Here is the code i thought of:
ps auxw | grep $service | grep -v grep > /dev/null
if [ $? != 0 ]
/opt/apromore/ApromoreCode/build.xml start-virgo > /dev/null
echo Apromore is running already
and this is the process I try to monitor (value from ps aux)
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -classpath usr/share/ant/lib/ant-launcher.jar:/ usr/share/java/xmlParserAPIs.jar:/usr/share/java/xercesImpl.jar -Dant.home=/usr/ share/ant -Dant.library.dir=/usr/share/ant/lib org.apache.tools.ant.launch.Launc her -cp start-virgo
but even when the process is running, i cant identify it with the mentioned script. There is a error called $'\r'. I have no idea how to get rid of it.