Skip to content

Instantly share code, notes, and snippets.

@jerry-sl
Created June 27, 2019 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerry-sl/8c121fe5b8bef46270a3af52f4ece264 to your computer and use it in GitHub Desktop.
Save jerry-sl/8c121fe5b8bef46270a3af52f4ece264 to your computer and use it in GitHub Desktop.
#!/bin/bash
while true; do
pid=`ps -ef |grep binary_name |grep -v grep |awk '{print $2}'`
if [ -n "$pid" ]; then
kill -15 $pid
echo "The process is exiting, it may take some time, forcing the exit may cause damage to the database, please wait patiently..."
sleep 1
else
echo "binary_name process killed successfully!"
break
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment