ზ3በંવવხްុլRxስសلçໂH℅૩/usr/local/bin/
Upload File :
Current File : //usr/local/bin/prop
#!/bin/bash

RED_COLOR=$'\033[31;1m'
DEFAULT_COLOR=$'\033[0m'

function Create_Propagation_File
{
if [  "$(whoami)" = 'root' ]; then

 docroot=$(uapi --user="$user" DomainInfo single_domain_data domain="$domain" | grep "documentroot:" | cut -d ' ' -f 6)

else

 docroot=$(uapi DomainInfo single_domain_data domain="$domain" | grep "documentroot:" | cut -d ' ' -f 6)

fi

if [ -d "$docroot" ]; then

 echo 'FastComet: Propagation is Over!' > "$docroot"/propagation.txt

 if [  "$(whoami)" = 'root' ]; then

  chown "$user": "$docroot"/propagation.txt

 fi

 echo  http://"$domain"/propagation.txt 

else

 printf "%sDocument root for %s does not exist!%s\\n" "$RED_COLOR" "$domain" "$DEFAULT_COLOR"  

fi
}

if [  "$(whoami)" = 'root' ]; then

 while (true); do

  read -e -r -p $'\e[36mType cPanel Username or "all" for all users on the server:\e[0m ' user;

  if [ -z "$user" ]; then

   printf "%sNo User Specified!%s\\n" "$RED_COLOR" "$DEFAULT_COLOR"
   continue

  fi

  if [  "$user" = all ]; then

   for user in $(whmapi1 listaccts | grep 'user' | awk '{print$2}'); do
    for domain in $(uapi --user="$user" DomainInfo list_domains | grep 'main_domain\|-' | awk '{print$2}' | sed '/^[[:space:]]*$/d'); do

     Create_Propagation_File
   
    done
   done

   break

  else

   if [ -n "$(whmapi1 listaccts search="$user" searchtype=user | grep 'user:' | awk '{print$1}')" ]; then

    for domain in $(uapi --user="$user" DomainInfo list_domains | grep 'main_domain\|-' | awk '{print$2}' | sed '/^[[:space:]]*$/d'); do

     Create_Propagation_File

    done
   
    break
   
   else

    printf "%sInvalid Username!%s\\n" "$RED_COLOR" "$DEFAULT_COLOR"

   fi
  fi
 done

else

 for domain in $(uapi DomainInfo list_domains | grep 'main_domain\|-' | awk '{print$2}' | sed '/^[[:space:]]*$/d'); do

  Create_Propagation_File

 done
fi