diff --git a/init-docker.sh b/init-docker.sh index b211a69..c38af06 100644 --- a/init-docker.sh +++ b/init-docker.sh @@ -27,18 +27,19 @@ else echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.martin98.com/repository/docker-ce/linux/$lsb_dist $release stable" > /etc/apt/sources.list.d/docker.list curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/docker-install.sh | sh - cat > /etc/docker/daemon.json < /etc/docker/daemon.json </dev/null 2>&1; then - systemctl restart docker - else - echo "systemctl 不存在,跳过 docker 重启。" - fi +if pidof systemd >/dev/null 2>&1; then + systemctl restart docker +else + echo "systemctl 不存在,跳过 docker 重启。" fi \ No newline at end of file