You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
auto/restart_auto.sh

28 lines
609 B

#!/bin/bash
# 定义一个函数来检查上一个命令是否执行成功
check_status() {
if [ $? -eq 0 ]; then
echo "操作成功: $1"
else
echo "操作失败: $1"
exit 1
fi
}
# 切换到auto的source目录并更新代码
cd ~/apps/auto/source/auto
check_status "切换到目录 ~/auto/source/auto"
git reset --hard
git pull
check_status "执行 git pull"
# 切换到auto目录并重启docker服务
cd ~/apps/qinglong-auto
check_status "切换到目录 ~/apps/auto"
docker-compose restart
check_status "重启 docker-compose 服务"
echo "所有操作已完成。"