From 28c8bdb6a817f1d1e006f962b5c7e42ef1fbb4b9 Mon Sep 17 00:00:00 2001 From: Darren <27513732@qq.com> Date: Thu, 28 Sep 2023 09:25:04 +0800 Subject: [PATCH] systemd --- systemd/script/set_hosts.sh | 4 ++-- systemd/script/start_up.sh | 4 +--- systemd/websoft9.service | 6 ++++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/systemd/script/set_hosts.sh b/systemd/script/set_hosts.sh index 4be0a661..d5d9b308 100644 --- a/systemd/script/set_hosts.sh +++ b/systemd/script/set_hosts.sh @@ -9,7 +9,7 @@ set -e container_name="websoft9-apphub" # 最大尝试次数 -max_attempts=60 +max_attempts=6 # 获取容器的内网IP attempt=0 @@ -21,7 +21,7 @@ while [ $attempt -lt $max_attempts ]; do fi attempt=$(( $attempt + 1 )) - sleep 1 + sleep 5 done # 检查获取IP是否成功 diff --git a/systemd/script/start_up.sh b/systemd/script/start_up.sh index 9b4a7271..9b4837ae 100644 --- a/systemd/script/start_up.sh +++ b/systemd/script/start_up.sh @@ -1,6 +1,4 @@ #!/bin/bash -# 在这个脚本中,我们将运行两个脚本 /bin/bash send_credentials.sh -/bin/bash set_hosts.sh -tail -f /dev/null \ No newline at end of file +/bin/bash set_hosts.sh \ No newline at end of file diff --git a/systemd/websoft9.service b/systemd/websoft9.service index 5889acf2..c8fa8560 100644 --- a/systemd/websoft9.service +++ b/systemd/websoft9.service @@ -1,15 +1,17 @@ [Unit] -Description=Websoft9 PaaS Platform +Description=Websoft9 Linux AppStore Requires=network.target docker After=network.target docker [Service] WorkingDirectory=/opt/websoft9/systemd ExecStart=/bin/bash /opt/websoft9/systemd/start_up.sh -Restart=always +Restart=on-failure Type=simple NotifyAccess=all StandardError=syslog +User=root +Group=root [Install] WantedBy=multi-user.target \ No newline at end of file