#!/bin/bash jar_name="nbd-wios-manage-2.0.0.jar" jar_pid=`ps -ef|grep -v grep | grep ${jar_name}|awk '{ print $2 }'` echo $jar_pid if [ ! -n "$jar_pid" ]; then echo "${jar_name} is stopped." else kill -9 $jar_pid echo "kill ${jar_pid}" echo "${jar_name} is stopped." fi