From 60d048f82acbf3a35b626f0f33782c4c73e77b86 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sat, 10 Sep 2022 23:58:50 +0500 Subject: [PATCH] bug fix that causes upgrade to stuck --- plogical/upgrade.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index b53977862..f7d4f85e1 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2561,18 +2561,19 @@ vmail @staticmethod def runSomeImportantBash(): + # Remove invalid crons from /etc/crontab Reference: https://github.com/usmannasir/cyberpanel/issues/216 - # command = """sed -i '/CyberCP/d' /etc/crontab""" - # Upgrade.executioner(command, command, 0, True) - # - # if os.path.exists('/usr/local/lsws/conf/httpd.conf'): - # # Setup /usr/local/lsws/conf/httpd.conf to use new Logformat standard for better stats and accesslogs - # command = """sed -i "s|^LogFormat.*|LogFormat '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' combined|g" /usr/local/lsws/conf/httpd.conf""" - # Upgrade.executioner(command, command, 0, True) - # - # # Fix all existing vhost confs to use new Logformat standard for better stats and accesslogs - # command = """find /usr/local/lsws/conf/vhosts/ -type f -name 'vhost.conf' -exec sed -i "s/.*CustomLog.*/ LogFormat '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' combined\n&/g" {} \;""" - # Upgrade.executioner(command, command, 0, True) + command = """sed -i '/CyberCP/d' /etc/crontab""" + Upgrade.executioner(command, command, 0, True) + + if os.path.exists('/usr/local/lsws/conf/httpd.conf'): + # Setup /usr/local/lsws/conf/httpd.conf to use new Logformat standard for better stats and accesslogs + command = """sed -i "s|^LogFormat.*|LogFormat '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' combined|g" /usr/local/lsws/conf/httpd.conf""" + Upgrade.executioner(command, command, 0, True) + + # Fix all existing vhost confs to use new Logformat standard for better stats and accesslogs + command = """find /usr/local/lsws/conf/vhosts/ -type f -name 'vhost.conf' -exec sed -i "s/.*CustomLog.*/ LogFormat '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' combined\n&/g" {} \;""" + Upgrade.executioner(command, command, 0, True) # Install any Cyberpanel missing crons to root crontab so its visible to users via crontab -l as root user