Skip to content

Commit

Permalink
其他更新:workflow 添加打包了linux一键启动和关闭redis的脚本(对齐Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
KOROyo123 committed May 22, 2024
1 parent d4989d2 commit eee28c0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/Ububtu-Clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ jobs:
run: cd ${{github.workspace}}/env/redis-7.2.1 && make MALLOC=libc

- name: Pack-Env
run: cp ${{github.workspace}}/env/redis-7.2.1/src/redis-server ${{github.workspace}}/bin/Koro_Caster_Service/env
run: |
cp ${{github.workspace}}/env/redis-7.2.1/src/redis-server ${{github.workspace}}/bin/Koro_Caster_Service/env
cp ${{github.workspace}}/env/start-redis.sh ${{github.workspace}}/bin/Koro_Caster_Service/env
cp ${{github.workspace}}/env/stop-redis.sh ${{github.workspace}}/bin/Koro_Caster_Service/env
- name: Get tag version
id: tag_version
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/Ubuntu-GCC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ jobs:
run: cd ${{github.workspace}}/env/redis-7.2.1 && make MALLOC=libc

- name: Pack-Env
run: cp ${{github.workspace}}/env/redis-7.2.1/src/redis-server ${{github.workspace}}/bin/Koro_Caster_Service/env
run: |
cp ${{github.workspace}}/env/redis-7.2.1/src/redis-server ${{github.workspace}}/bin/Koro_Caster_Service/env
cp ${{github.workspace}}/env/start-redis.sh ${{github.workspace}}/bin/Koro_Caster_Service/env
cp ${{github.workspace}}/env/stop-redis.sh ${{github.workspace}}/bin/Koro_Caster_Service/env
- name: Get tag version
id: tag_version
run: echo "::set-output name=tag_version::$(git describe --tags --dirty=-dev)"
Expand Down
10 changes: 10 additions & 0 deletions env/start-redis.sh
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
22 changes: 22 additions & 0 deletions env/stop-redis.sh
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

0 comments on commit eee28c0

Please sign in to comment.