diff --git a/cyberpanel.sh b/cyberpanel.sh index 5d7ef0f51..7f1398460 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -2295,13 +2295,59 @@ Post_Install_Addon_Mecached_LSMCD() { cd "$Current_Dir/lsmcd-master" || exit ./fixtimestamp.sh ./configure CFLAGS=" -O3" CXXFLAGS=" -O3" - make - make install + + # Compile LSMCD + if make; then + echo "LSMCD compilation successful" + if make install; then + echo "LSMCD installation successful" + + # Create systemd service file for LSMCD + cat > /etc/systemd/system/lsmcd.service << 'EOF' +[Unit] +Description=LiteSpeed Memcached (LSMCD) +After=network.target + +[Service] +Type=forking +PIDFile=/var/run/lsmcd.pid +ExecStart=/usr/local/bin/lsmcd -d +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF + + # Reload systemd and enable LSMCD service + systemctl daemon-reload + systemctl enable lsmcd + systemctl start lsmcd + + if systemctl is-active --quiet lsmcd; then + echo "LSMCD service started successfully" + touch /home/cyberpanel/lsmcd + else + echo "Warning: LSMCD service failed to start" + fi + else + echo "Error: LSMCD installation failed" + fi + else + echo "Error: LSMCD compilation failed" + fi + cd "$Current_Dir" || exit - manage_service "lsmcd" "enable" - manage_service "lsmcd" "start" - log_info "LSMCD installation completed" + # Only manage service if it was successfully installed + if systemctl list-unit-files | grep -q "lsmcd.service"; then + manage_service "lsmcd" "enable" + manage_service "lsmcd" "start" + log_info "LSMCD installation completed successfully" + else + log_warning "LSMCD installation failed - service not registered" + fi log_function_end "Post_Install_Addon_Mecached_LSMCD" } diff --git a/install/install.py b/install/install.py index da175c5d5..a19801db2 100644 --- a/install/install.py +++ b/install/install.py @@ -3742,12 +3742,13 @@ def show_installation_summary(): # Check component status components = { "CyberPanel Core": check_service_status("lscpd"), - "OpenLiteSpeed": check_service_status("lsws"), + "OpenLiteSpeed": check_openlitespeed_status(), "MariaDB/MySQL": check_service_status("mysql") or check_service_status("mariadb"), - "PowerDNS": check_service_status("pdns") or check_service_status("pdns-server"), - "Pure-FTPd": check_service_status("pure-ftpd"), + "PowerDNS": check_powerdns_status(), + "Pure-FTPd": check_pureftpd_status(), "Postfix": check_service_status("postfix"), "Dovecot": check_service_status("dovecot"), + "LSMCD": check_service_status("lsmcd"), "SnappyMail": check_file_exists("/usr/local/CyberCP/public/snappymail"), "phpMyAdmin": check_file_exists("/usr/local/CyberCP/public/phpmyadmin") } @@ -3807,6 +3808,64 @@ def check_service_status(service_name): except: return False +def check_openlitespeed_status(): + """Check if OpenLiteSpeed is running (special case)""" + try: + # Check if lsws process is running + result = subprocess.run(['pgrep', '-f', 'litespeed'], capture_output=True, text=True) + if result.returncode == 0: + return True + + # Check if lsws service is active + result = subprocess.run(['systemctl', 'is-active', 'lsws'], capture_output=True, text=True) + if result.returncode == 0: + return True + + # Check if openlitespeed service is active + result = subprocess.run(['systemctl', 'is-active', 'openlitespeed'], capture_output=True, text=True) + if result.returncode == 0: + return True + + return False + except: + return False + +def check_powerdns_status(): + """Check if PowerDNS is running (special case)""" + try: + # Check if pdns process is running + result = subprocess.run(['pgrep', '-f', 'pdns'], capture_output=True, text=True) + if result.returncode == 0: + return True + + # Check various PowerDNS service names + for service in ['pdns', 'pdns-server', 'powerdns']: + result = subprocess.run(['systemctl', 'is-active', service], capture_output=True, text=True) + if result.returncode == 0: + return True + + return False + except: + return False + +def check_pureftpd_status(): + """Check if Pure-FTPd is running (special case)""" + try: + # Check if pure-ftpd process is running + result = subprocess.run(['pgrep', '-f', 'pure-ftpd'], capture_output=True, text=True) + if result.returncode == 0: + return True + + # Check various Pure-FTPd service names + for service in ['pure-ftpd', 'pureftpd']: + result = subprocess.run(['systemctl', 'is-active', service], capture_output=True, text=True) + if result.returncode == 0: + return True + + return False + except: + return False + def fix_django_autofield_warnings(): """Fix Django AutoField warnings by setting DEFAULT_AUTO_FIELD""" try: