Create UPDATE.sh

This commit is contained in:
Stefan Pejcic 2025-03-31 14:12:19 +02:00 committed by GitHub
parent 29ec888bb0
commit d857d4edb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

25
version/1.1.8/UPDATE.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
wget -O /etc/openpanel/apache/httpd.conf https://raw.githubusercontent.com/stefanpejcic/openpanel-configuration/refs/heads/main/apache/httpd.conf
INSERT_TEXT="Listen 443"
for dir in /home/*; do
file="$dir/httpd.conf"
user=$(basename "$dir")
if [[ -f "$file" ]]; then
if ! grep -q "$INSERT_TEXT" "$file"; then
sed -i "/Listen 80/a \\
$INSERT_TEXT" "$file"
echo "Updated: $file"
if docker --context "$user" ps --format '{{.Names}}' | grep "apache"; then
cd /home/"$user"
docker --context "$user" compose down apache
docker --context "$user" compose up -d apache
echo "Apache restarted for user: $user"
fi
fi
fi
done