OS/Linux

stop(kill) script

아르비스 2017. 2. 16. 21:14

#!/bin/sh


if [ -z "`ps -eaf | grep mattermost | grep java`" ]; then

  echo "Mattermost was not started."

else

  ps -eaf | grep mattermost | grep java | awk '{print $2}' |

  while read PID

  do

    echo "Killing $PID ..."

    kill -9 $PID

    echo

    echo "Mattermost is being shutdowned."

  done

fi