#!/bin/sh echo "Stopping service..." cd ../ PROCESS=`pwd | xargs -i basename {}` PID=`ps -ef | grep "\./$PROCESS" | grep -v grep | awk '{print $2}'` kill -TERM $PID if [ $? != "0" ]; then echo "Can't stop." exit 1 else echo "Service stoped." exit 0 fi