diff --git a/init-apt.sh b/init-apt.sh index ffc3262..01144a8 100644 --- a/init-apt.sh +++ b/init-apt.sh @@ -38,7 +38,7 @@ server ntp5.aliyun.com iburst driftfile /var/lib/chrony/drift allow 127.0.0.1 EOF -if command -v systemctl >/dev/null 2>&1; then +if pidof systemd >/dev/null 2>&1; then systemctl restart chrony && systemctl enable chrony else echo "systemctl 不存在,跳过 chrony 的重启" diff --git a/init-docker.sh b/init-docker.sh index 6dbe239..795a69d 100644 --- a/init-docker.sh +++ b/init-docker.sh @@ -21,7 +21,7 @@ cat > /etc/docker/daemon.json </dev/null 2>&1; then +if pidof systemd >/dev/null 2>&1; then systemctl restart docker else echo "systemctl 不存在,跳过 docker 重启。"