Skip to content

Commit

Permalink
fix: Upgrading the existence of coredump messages
Browse files Browse the repository at this point in the history
SIGTERM to dde-grand-search-daemon use `preinstall` script

Log: as title

Bug: https://pms.uniontech.com/bug-view-268325.html
  • Loading branch information
Johnson-zs authored and deepin-bot[bot] committed Aug 19, 2024
1 parent 8f9128c commit ea28404
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions debian/dde-grand-search.preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# 进程名称
PROCESS_NAME="dde-grand-search-daemon"

# 获取进程ID
PID=$(pgrep -f "$PROCESS_NAME")

if [ -z "$PID" ]; then
echo "Process $PROCESS_NAME is not running."
exit 0
fi

echo "Process $PROCESS_NAME (PID: $PID) found. Attempting to terminate..."

# 发送 SIGTERM 信号
kill -TERM "$PID"
sleep 2 # 等待进程响应 SIGTERM

# 再次检查进程是否仍在运行
if pgrep -f "$PROCESS_NAME" > /dev/null; then
echo "Process did not terminate. Sending SIGKILL..."
# 发送 SIGKILL 信号
kill -KILL "$PID"
echo "Process $PROCESS_NAME has been killed."
else
echo "Process $PROCESS_NAME terminated successfully."
fi

0 comments on commit ea28404

Please sign in to comment.