403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.164
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/lib64/nagios/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/lib64/nagios/plugins/check_a2_httpdconf.shared
#!/bin/bash

# Script to ensure httpd.conf has no errors and can be rebuilt without any failure.
# BFENG-504
# Refactored May 2024 | BFENG-1045

cpversion=$(cat /usr/local/cpanel/version)
httpd_conf="/etc/apache2/conf/httpd-preview.conf"
httpd_conf_rebuild_log="/var/log/httpd_conf_errors.log"

# Excluding httpd.conf rebuild if it's not cPanel
if [ -z "$cpversion" ]; then
  /usr/sbin/apachectl configtest &>/dev/null
  if [ $? -eq 0 ]; then
    echo "httpd.conf has passed syntax check."
    exit 0
  else
    echo "httpd.conf isn't valid."
    exit 2
  fi
else
  temp_output=$(mktemp)
  max_attempts=3
  attempt=1
  retry_delay=5

  while [ $attempt -le $max_attempts ]; do
    /usr/local/cpanel/scripts/rebuildhttpdconf --preview &> "$temp_output"
    if [ $? -eq 0 ]; then
      echo "httpd.conf has passed syntax check and successfully rebuilt."
      exit 0
      rm -f "$temp_output"
      exit 
    elif [ $attempt -lt $max_attempts ]; then
      sleep $retry_delay
    fi
    attempt=$((attempt + 1))
  done

  echo "httpd.conf rebuild failed."
  exit 2
  echo -e "$(date '+%Y-%m-%d %H:%M:%S')\n$(cat "$temp_output")" >> "$httpd_conf_rebuild_log"
  rm -f "$temp_output"
fi

Youez - 2016 - github.com/yon3zu
LinuXploit