Update UPDATE.sh

This commit is contained in:
Stefan Pejcic 2025-04-25 15:37:32 +02:00 committed by GitHub
parent 3a5c036a88
commit fcf8ed60d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,24 +1,17 @@
#!/bin/bash
# Loop through all directories in /home/
echo ""
echo "Downloading crons.ini template.."
wget -q -O "/etc/openpanel/ofelia/users.ini" "https://raw.githubusercontent.com/stefanpejcic/openpanel-configuration/refs/heads/main/ofelia/users.ini"
for dir in /home/*; do
username=$(basename "$dir")
CONF_PATH="$dir/crons.ini"
USER_CONF="/etc/openpanel/$username/users.ini"
# 1. Handle crons.ini directory -> convert to file
if [ -d "$CONF_PATH" ]; then
echo "Found directory: $CONF_PATH - removing and creating a file."
rm -rf "$CONF_PATH" && touch "$CONF_PATH"
fi
# 2. Check if users.ini exists
if [ ! -f "$USER_CONF" ]; then
echo "users.ini not found for $username, creating it..."
mkdir -p "/etc/openpanel/$username/"
wget -q -O "$USER_CONF" "https://raw.githubusercontent.com/stefanpejcic/openpanel-configuration/refs/heads/main/ofelia/users.ini"
else
echo "users.ini exists for $username, skipping."
fi
done