Terminal a giye command run korun

cmd: nano check_lsws.sh

then ei code paste kore save korun.

cmd link and niseu deya ase cmd,

https://pubtext.cpanelcentral.com/8af240dc-e524-431d-b307-d7c59a923807

cmd:

#!/bin/bash

# Check if the script is run as root
if [[ $EUID -ne 0 ]]; then
echo “This script must be run as root”
exit 1
fi

# Define functions for switching between LiteSpeed and Apache
switch_to_apache() {
chmod +x /usr/local/lsws/admin/misc/cp_switch_ws.sh
/usr/local/lsws/admin/misc/cp_switch_ws.sh apache
}

switch_to_litespeed() {
chmod +x /usr/local/lsws/admin/misc/cp_switch_ws.sh
/usr/local/lsws/admin/misc/cp_switch_ws.sh litespeed
}

# Check the license status using /usr/bin/licD_litespeed
license_status=$(sudo /usr/bin/licD_litespeed | grep “Your license does not require an update or activation”)
if [[ -n $license_status ]]; then
# If the license does not require an update or activation, check the status of the LSWS service
if pgrep -x “litespeed” > /dev/null; then
# If the LSWS service is running, check if it has failed
service_status=$(systemctl status lsws | grep “Active: active (running)”)
process_status=$(systemctl status lsws | grep “Process: .*ExecStop.*code=exited, status=1/FAILURE”)
if [[ -z $service_status ]]; then
# If the LSWS service has failed, start it
systemctl start lsws
echo “LiteSpeed server started.”
elif [[ -n $process_status ]]; then
# If the LSWS service is running but not responding, restart it
systemctl restart lsws
echo “LiteSpeed server restarted.”
else
echo “LiteSpeed server is already running.”
fi
else
# If the LSWS service is not running, switch to LiteSpeed
switch_to_litespeed
echo “Switched to LiteSpeed server.”
fi
else
# If the license requires an update or activation, switch to Apache
switch_to_apache
echo “LiteSpeed is not licensed or not running. Switching to Apache.”
fi

 

erpor ata run korun:
cmd: chmod +x /root/check_lsws.sh
then:
cmd: echo “*/2 * * * * * sudo sh /root/check_lsws.sh > /etc/cron.d/CheckLSWS”
erpor akbar run korun
cmd:  sh check_lsws.sh