Просмотр исходного кода

3289 [Bug] awstats not updated by logrotate (#3297)

* Fix #3289 Awasts  errors

* Update installers to replace apache2 log rotate

* Forgot to commit the change

* Fix output email

* Update for upgrades
Jaap Marcus 3 лет назад
Родитель
Сommit
2d66a472cb

+ 4 - 0
install/deb/logrotate/httpd-prerotate/awstats

@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Changes made by HestiaCP due to https://github.com/hestiacp/hestiacp/issues/3289
+/usr/local/hestia/bin/v-update-sys-queue webstats

+ 4 - 2
install/hst-install-debian.sh

@@ -1035,6 +1035,8 @@ systemctl restart ssh
 
 # Disable AWStats cron
 rm -f /etc/cron.d/awstats
+# Replace awstatst function
+cp -f $HESTIA_INSTALL_DIR/logrotate/httpd-prerotate/* /etc/logrotate.d/httpd-prerotate/
 
 # Set directory color
 if [ -z "$(grep 'LS_COLORS="$LS_COLORS:di=00;33"' /etc/profile)" ]; then
@@ -2112,9 +2114,9 @@ Ready to get started? Log in using the following credentials:
 
 	Admin URL:  https://$servername:$port"
 if [ "$host_ip" != "$ip" ]; then
-	echo "	Backup URL:  https://$ip:$port"
+	echo -n "	Backup URL: https://$ip:$port"
 fi
-echo -e " 	Username:   admin
+echo -e -n " 	Username:   admin
 	Password:   $displaypass
 
 Thank you for choosing Hestia Control Panel to power your full stack web server,

+ 6 - 4
install/hst-install-ubuntu.sh

@@ -1036,6 +1036,8 @@ systemctl restart ssh
 
 # Disable AWStats cron
 rm -f /etc/cron.d/awstats
+# Replace awstatst function
+cp -f $HESTIA_INSTALL_DIR/logrotate/httpd-prerotate/* /etc/logrotate.d/httpd-prerotate/
 
 # Set directory color
 if [ -z "$(grep 'LS_COLORS="$LS_COLORS:di=00;33"' /etc/profile)" ]; then
@@ -2160,11 +2162,11 @@ You have successfully installed Hestia Control Panel on your server.
 
 Ready to get started? Log in using the following credentials:
 
-	Admin URL:  https://$servername:$port"
+	Admin URL:  https://$servername:$port" > $tmpfile
 if [ "$host_ip" != "$ip" ]; then
-	echo "	Backup URL:  https://$ip:$port"
+	echo "	Backup URL: https://$ip:$port" >> $tmpfile
 fi
-echo -e " 	Username:   admin
+echo -e -n " 	Username:   admin
 	Password:   $displaypass
 
 Thank you for choosing Hestia Control Panel to power your full stack web server,
@@ -2189,7 +2191,7 @@ Sincerely yours,
 The Hestia Control Panel development team
 
 Made with love & pride by the open-source community around the world.
-" > $tmpfile
+" >> $tmpfile
 
 send_mail="$HESTIA/web/inc/mail-wrapper.php"
 cat $tmpfile | $send_mail -s "Hestia Control Panel" $email

+ 6 - 0
install/upgrade/versions/1.7.0.sh

@@ -100,6 +100,12 @@ if echo "$BACKUP_SYSTEM" | grep "google" > /dev/null; then
 	add_upgrade_message "Deprecation notice: Backup via Google Cloud has been removed setup backup again via Rclone to reinstate the backup and restore capebilities!"
 fi
 
+if [ -f /etc/logrotate.d/httpd-prerotate/awstats ]; then
+	echo "[ * ] Update Awstats prerotate to Hestia update method"
+	# Replace awstatst function
+	cp -f $HESTIA_INSTALL_DIR/logrotate/httpd-prerotate/awstats /etc/logrotate.d/httpd-prerotate/
+fi
+
 if [ "$PHPMYADMIN_KEY" != "" ]; then
 	echo "[ * ] Refresh hestia-sso for PMA..."
 	$BIN/v-delete-sys-pma-sso quiet