-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
其他更新:workflow 添加打包了linux一键启动和关闭redis的脚本(对齐Windows)
- Loading branch information
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# 获取脚本文件所在的目录 | ||
script_dir=$(dirname "$(realpath "$0")") | ||
|
||
# 切换到脚本文件所在的目录 | ||
cd "$script_dir" || { echo "Failed to change directory to $script_dir"; exit 1; } | ||
|
||
# 执行当前目录下的程序 | ||
./redis-server redis.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# 要停止的程序名称 | ||
program_name="redis-server" | ||
|
||
# 获取所有匹配的 PID | ||
pids=$(pgrep -f "$program_name") | ||
|
||
# 检查是否找到任何进程 | ||
if [ -z "$pids" ]; then | ||
echo "No processes found for $program_name" | ||
exit 0 | ||
fi | ||
|
||
# 逐一停止所有找到的进程 | ||
for pid in $pids; do | ||
if kill "$pid" 2>/dev/null; then | ||
echo "Process $pid stopped successfully" | ||
else | ||
echo "Failed to stop process $pid or process is not running" | ||
fi | ||
done |