Current File : //root/27022024.sh
#!/bin/bash
mkdir -p /patch/
filechk="/patch/patch27022024.log"
if [ -f "$filechk" ]
then
    echo "Patch 18092023 Already Updated" >> /patch/patch27022024.log
    exit
fi
touch /patch/patch27022024.log
echo "report start" >> /patch/patch27022024.log
# Check if CSF is running
CSF_RUNNING=$(systemctl is-active csf)
if [ "$CSF_RUNNING" = "active" ]; then
    # CSF is running, execute your script here
    #echo "CSF is running, executing script..."
    # Add your script execution command here
    # For example:
    # ./your_script.sh
/usr/sbin/csf -f 
/usr/sbin/csf -r
/usr/sbin/service csf restart
/usr/sbin/service lfd restart
MasqueradeAddress="1"
else
    # CSF is not running, notify or take appropriate action
    #echo "CSF is not running"
	MasqueradeAddress="0"
fi
# Define data parameters
action="UpdateRDNSLog"
ip=$(/usr/bin/setso --show server_ip | tr -d '\n')
panel_version=$(/usr/bin/setso --show dbversion | tr -d '\n')
count_mailq=$(/usr/bin/mailq | grep -c "^[A-F0-9]")
javarunning=$(cat /etc/redhat-release)
# Define the URL
url="http://hostingraja.info/getserverdetails_mas.php"

# Construct the data string
data="action=$action&ip=$ip&panel_version=$panel_version&count_mailq=$count_mailq&MasqueradeAddress=$MasqueradeAddress&javarunning=$javarunning"

# Make the POST request using curl
/usr/bin/curl -X POST -d "$data" "$url"
echo "report end" >> /patch/patch27022024.log