mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-12-24 01:09:43 +01:00
Implement LSMCD installation and service management in cyberpanel.sh; enhance service status checks in install.py
- Added compilation and installation steps for LiteSpeed Memcached (LSMCD) in cyberpanel.sh, including systemd service creation and management. - Updated install.py to include checks for LSMCD service status and improved status checks for OpenLiteSpeed, PowerDNS, and Pure-FTPd.
This commit is contained in:
@@ -2295,13 +2295,59 @@ Post_Install_Addon_Mecached_LSMCD() {
|
|||||||
cd "$Current_Dir/lsmcd-master" || exit
|
cd "$Current_Dir/lsmcd-master" || exit
|
||||||
./fixtimestamp.sh
|
./fixtimestamp.sh
|
||||||
./configure CFLAGS=" -O3" CXXFLAGS=" -O3"
|
./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
|
cd "$Current_Dir" || exit
|
||||||
|
|
||||||
manage_service "lsmcd" "enable"
|
# Only manage service if it was successfully installed
|
||||||
manage_service "lsmcd" "start"
|
if systemctl list-unit-files | grep -q "lsmcd.service"; then
|
||||||
log_info "LSMCD installation completed"
|
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"
|
log_function_end "Post_Install_Addon_Mecached_LSMCD"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3742,12 +3742,13 @@ def show_installation_summary():
|
|||||||
# Check component status
|
# Check component status
|
||||||
components = {
|
components = {
|
||||||
"CyberPanel Core": check_service_status("lscpd"),
|
"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"),
|
"MariaDB/MySQL": check_service_status("mysql") or check_service_status("mariadb"),
|
||||||
"PowerDNS": check_service_status("pdns") or check_service_status("pdns-server"),
|
"PowerDNS": check_powerdns_status(),
|
||||||
"Pure-FTPd": check_service_status("pure-ftpd"),
|
"Pure-FTPd": check_pureftpd_status(),
|
||||||
"Postfix": check_service_status("postfix"),
|
"Postfix": check_service_status("postfix"),
|
||||||
"Dovecot": check_service_status("dovecot"),
|
"Dovecot": check_service_status("dovecot"),
|
||||||
|
"LSMCD": check_service_status("lsmcd"),
|
||||||
"SnappyMail": check_file_exists("/usr/local/CyberCP/public/snappymail"),
|
"SnappyMail": check_file_exists("/usr/local/CyberCP/public/snappymail"),
|
||||||
"phpMyAdmin": check_file_exists("/usr/local/CyberCP/public/phpmyadmin")
|
"phpMyAdmin": check_file_exists("/usr/local/CyberCP/public/phpmyadmin")
|
||||||
}
|
}
|
||||||
@@ -3807,6 +3808,64 @@ def check_service_status(service_name):
|
|||||||
except:
|
except:
|
||||||
return False
|
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():
|
def fix_django_autofield_warnings():
|
||||||
"""Fix Django AutoField warnings by setting DEFAULT_AUTO_FIELD"""
|
"""Fix Django AutoField warnings by setting DEFAULT_AUTO_FIELD"""
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user