From 1d36cdba41e89730921815e47194c10c7f413d16 Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Sun, 5 Jan 2025 23:45:23 +0800 Subject: [PATCH] =?UTF-8?q?[*]=20=E5=85=BC=E5=AE=B9action=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/demo.yaml | 6 ++++-- init-apt.sh | 6 +++++- init-docker.sh | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 3d74cd6..5a62beb 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -6,5 +6,7 @@ jobs: Explore-Gitea-Actions: runs-on: ubuntu-latest steps: - - run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash - - run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash \ No newline at end of file + - name: test apt + run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash + - name: test docker + run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash \ No newline at end of file diff --git a/init-apt.sh b/init-apt.sh index aab715e..ffc3262 100644 --- a/init-apt.sh +++ b/init-apt.sh @@ -38,4 +38,8 @@ server ntp5.aliyun.com iburst driftfile /var/lib/chrony/drift allow 127.0.0.1 EOF -systemctl restart chrony && systemctl enable chrony \ No newline at end of file +if command -v systemctl >/dev/null 2>&1; then + systemctl restart chrony && systemctl enable chrony +else + echo "systemctl 不存在,跳过 chrony 的重启" +fi \ No newline at end of file diff --git a/init-docker.sh b/init-docker.sh index 6173005..6dbe239 100644 --- a/init-docker.sh +++ b/init-docker.sh @@ -21,4 +21,8 @@ cat > /etc/docker/daemon.json </dev/null 2>&1; then + systemctl restart docker +else + echo "systemctl 不存在,跳过 docker 重启。" +fi