Skip to content

Commit

Permalink
Optimize stop script
Browse files Browse the repository at this point in the history
  • Loading branch information
doleyzi committed Apr 11, 2024
1 parent ffe1ecf commit a1b0ef4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions inlong-audit/bin/service-stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,24 @@
# under the License.
#

# this program kills the audit store
ps -ef |grep "audit-service" | grep -v grep|awk '{print $2}' | xargs kill -9
# this program kills the audit service
for i in {1..5}
do
pid=$(ps aux | grep "audit-service" | grep -v "grep" | awk '{print $2}')
if [ -z "$pid" ]; then
echo "audit-service is not running"
break
else
kill $pid
fi
sleep 10
done

pid=$(ps aux | grep "audit-service" | grep -v "grep" | awk '{print $2}')
if [ -z "$pid" ]; then
echo "audit-service has stopped"
else
kill -9 $pid
fi

echo "Stop audit-service successfully."

0 comments on commit a1b0ef4

Please sign in to comment.