stop.sh 273 B

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