diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 85d1f781051ac80ed9713584ac74fdbe584a1f67..4f53182a9b3db70940185d8e484ec2e61940e3a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,12 +30,11 @@ production: - sshpass -e scp complete/target/spring-boot-complete-0.0.1-SNAPSHOT.jar root@$APP_HOST:/usr/local/apps/hello-world/hello-world.jar # 部署应用为系统服务 - cat .gitlab-ci/hello-world.service | sshpass -e ssh root@$APP_HOST "cat > ./hello-world.service " - - sshpass -e ssh root@$APP_HOST "[[ -f /etc/systemd/system/hello-world.service ]] || { mv ./hello-world.service /etc/systemd/system/hello-world.service && systemctl daemon-reload && systemctl enable hello-world.service; }" + - sshpass -e ssh root@$APP_HOST "[[ -f /usr/lib/systemd/system/hello-world.service ]] || { mv ./hello-world.service /usr/lib/systemd/system/hello-world.service && systemctl daemon-reload && systemctl enable hello-world.service; }" - sshpass -e ssh root@$APP_HOST "[[ -f ./hello-world.service ]] && { rm ./hello-world.service; }" # 重启应用服务 - sshpass -e ssh root@$APP_HOST "systemctl restart hello-world" # 查看服务状态 - sshpass -e ssh root@$APP_HOST "systemctl status hello-world" only: - - main - + - main \ No newline at end of file