Refactor file paths and update cronjob for Cloudflare DDNS

This commit is contained in:
2024-09-23 12:19:11 +00:00
parent f724f2c1ed
commit c9114bda9b
2 changed files with 11 additions and 6 deletions

View File

@@ -1 +1 @@
*/30 * * * * root /app/cloudflare-ddns/run_script.sh */30 * * * * root /app/cloudflare-ddns/scripts/run_script.sh

View File

@@ -9,12 +9,17 @@ sudo apt install -y certbot python3-certbot-dns-cloudflare jq
sudo mkdir -p /app/cloudflare-ddns sudo mkdir -p /app/cloudflare-ddns
sudo cp -r $DIR/../* /app/cloudflare-ddns sudo cp -r $DIR/../* /app/cloudflare-ddns
if [ -f /app/cloudflare-ddns/config/env.json ]; then if [ -f /app/cloudflare-ddns/config/env.json ]; then
echo "Environment configuration file already exists. Back up the existing file and create a new file." read -p "Environment configuration file already exists. Do you want to overwrite it? (y/n): " overwrite
if [ "$overwrite" == "y" ]; then
sudo mv /app/cloudflare-ddns/config/env.json /app/cloudflare-ddns/config/env.json.bak sudo mv /app/cloudflare-ddns/config/env.json /app/cloudflare-ddns/config/env.json.bak
sudo cp $DIR/../config/env_example.json /app/cloudflare-ddns/config/env.json
sudo chmod 600 /app/cloudflare-ddns/config/env.json
fi fi
else
sudo mkdir -p /app/cloudflare-ddns/config sudo mkdir -p /app/cloudflare-ddns/config
sudo cp $DIR/../config/env_example.json /app/cloudflare-ddns/config/env.json sudo cp $DIR/../config/env_example.json /app/cloudflare-ddns/config/env.json
sudo chmod 600 /app/cloudflare-ddns/config/env.json sudo chmod 600 /app/cloudflare-ddns/config/env.json
fi
sudo cp $DIR/../cron/cronjob-ddns /etc/cron.d/cloudflare-ddns sudo cp $DIR/../cron/cronjob-ddns /etc/cron.d/cloudflare-ddns
echo "Please modify the environment configuration file and save it in the /app/cloudflare-ddns/config/env.json path." echo "Please modify the environment configuration file and save it in the /app/cloudflare-ddns/config/env.json path."