From d943f698212fa903ac3fecff03ab6133107facd2 Mon Sep 17 00:00:00 2001 From: jack30724 Date: Mon, 2 Dec 2024 17:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E5=85=B3=E7=AD=89=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E4=B8=AD=E5=8F=AF=E8=83=BD=E7=94=A8=E5=88=B0=E4=BA=86=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=90=8D=E7=A7=B0=E5=9F=9F=E5=90=8D(=E5=9C=A8?= =?UTF-8?q?=E5=A4=9A=E5=AE=B9=E5=99=A8=E6=97=B6=E7=9A=84=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=90=8D=E7=A7=B0)=EF=BC=8C=E5=A2=9E=E5=8A=A0=20hosts=20?= =?UTF-8?q?=E6=9D=A5=E8=AE=A9=E7=BD=91=E5=85=B3=E7=AD=89=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=88=90=E5=8A=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prestart.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/prestart.sh b/prestart.sh index 3517ea5..682c3c8 100644 --- a/prestart.sh +++ b/prestart.sh @@ -1,5 +1,21 @@ #!/bin/bash +# 定义要添加的主机名和IP 到 /etc/hosts +entries=( + "127.0.0.1 aospace-fileapi" + "127.0.0.1 aospace-redis" +) +# 遍历数组并检查每个条目是否已经存在于 /etc/hosts 中 +for entry in "${entries[@]}"; do + if ! grep -qF "$entry" /etc/hosts; then + echo "$entry" >> /etc/hosts + echo "Added: $entry" + else + echo "Already exists: $entry" + fi +done + + # 启动 Redis redis-server --requirepass placeholder_mysecretpassword --appendonly yes --appendfsync everysec --auto-aof-rewrite-percentage 100 --auto-aof-rewrite-min-size 100mb &