I have two scripts on Unix; one that starts some processes and the other one for killing a process. At first, I ran the .sh without WILY in it and it worked perfectly; in this way, I could also ran my stopper process. However I need WILY in this so I added it to my script but this time, a message about WILY shows up instead of the first version which is perfectly normal but when I try to run my stop process it doesn't work anymore; it probably couldn't find the process with the name given. Here are my scripts:
start_scpc.sh
export CLASSPATH='.:'
export CLASSPATH=$CLASSPATH'./resources'
cd lib
for file in *.jar; do export CLASSPATH=$CLASSPATH':./lib/'$file; done
cd ..
# --- define WILY java options here :: Must be declared at the beginning
## ------------------------------------------------------------------------------
WILY_HOME="/export/home/scpcstb/wily823"
WILY_OPTIONS="-javaagent:${WILY_HOME}/Agent.jar -Dcom.wily.introscope.agentProfile=${WILY_HOME}/IntroscopeAgent.profile -Dcom.wily.introscope.agent.agentName=SCPC_STB"
## ------------------------------------------------------------------------------
APPLICATION_NAME=SCPC_STB
MAIN='tr.com.turkcellteknoloji.scpc.core.Main'
JAVA_PARAM="-Xmx1g -Xbatch -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5563 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
echo "JVM"
echo "CHECKING $APPLICATION_NAME PROCESS"
if [ 0 == `pgrep -fl application=$APPLICATION_NAME | wc -l` ]
then
echo "....................STARTING $APPLICATION_NAME........................"
echo "Please wait"
echo "See log files for details"
/usr/jdks/scpcstb/bin/java -server ${WILY_OPTIONS} -Dapplication=$APPLICATION_NAME $JAVA_PARAM -cp $CLASSPATH $MAIN >> ./logs/scpcConsole.log 2>&1 &
sleep 1
until [ 0 != `pgrep -fl application=$APPLICATION_NAME | wc -l` ]; do
sleep 1
done
echo "....................$APPLICATION_NAME STARTED........................."
else
echo "$APPLICATION_NAME IS ALREADY RUNING!!!"
fi
exit 1
and my stop_scpc.sh:
pkill -f application=SCPC_STB
This pkill doesn't work anymore... Any help with this would be highly appreciated, thanks.