general_du_recommendations() {
  local partition=$1
  local intro
  if [[ $partition == "/" ]]; then
    local recommendations="In order to resolve the disk space issue on the main (root) partition, please remove some unnecessary files to avoid crashing of system services and maintain server stability (you can let us know which files could be removed, and we will do it for you)."
  elif [[ $partition == "/backup" ]]; then
    local included_accounts="$(grep ^BACKUP=1 /var/cpanel/users/* | awk -F'[:/]' 'BEGIN{ORS="|"} {print $(NF-1)}')"
    intro="We would like to let you know that not all the accounts could be backed up recently.\n"
    if [[ -n "$included_accounts" ]]; then
      [[ ${included_accounts: -1} == '|' ]] && included_accounts=${included_accounts::-1}
      local acc_data="$(whmapi1 get_disk_usage | grep -E "$included_accounts" -B 4 | awk -F': ' '/blocks_used/{print $2}')"
      local total_size="$(echo "$acc_data" | awk '{s+=$1} END{kb=s+0; if(kb<1024){u="KB";f=1}else if(kb<1048576){u="MB";f=1024}else if(kb<1073741824){u="GB";f=1048576}else{u="TB";f=1073741824} printf "%.2f %s\n", kb/f, u}')"
      intro+="The total size of your cPanel accounts ($total_size) that are supposed to be backed up has grown too large, and it prevents the process from being completed successfully.\n"
    fi
    local recommendations="${intro}\nIn order to resolve the disk space issue on the /backup partition, the following steps can be taken:\n- Remove unneeded files from your accounts (the statistics above can be used as a reference);\n- Exclude some additional files or directories from being backed up:\nhttps://support.cpanel.net/hc/en-us/articles/360052681834-How-to-Exclude-Files-from-Backups\nYou can set it up on a per-account basis, or we can update the global configuration for you.\n"

  [[ $IS_VPS == 'true' ]] && recommendations+="- Purchase additional backup storage space at the price of \$10 per 10 GB.\n"

  local acct_count="$(wc -l /etc/trueuserdomains | awk '{print $1}')"
  (( acct_count > 1 )) && recommendations+="- Exclude some cPanel accounts from the backup system;\n"

  fi
  recommendations+='\nA combination of these steps might be needed to fully resolve the issue.'
  echo "$recommendations"
}

backup_du_pulsar_quasar_recommendations() {
  echo "Additionally, you can consider upgrading to VPS Magnetar with 200 GB of remote backup storage, or to any Dedicated server.\nMore information can be found here:\nhttps://www.namecheap.com/hosting/vps/\nhttps://www.namecheap.com/hosting/dedicated-servers/"
}

backup_du_magnetar_recommendations() {
  echo "Additionally, you can consider upgrading to VPS Hypernova with 400 GB of remote backup storage, or to an Advanced-level Dedicated server that offers 500 GB of space for remote backups.\nMore information can be found here:\nhttps://www.namecheap.com/hosting/vps/\nhttps://www.namecheap.com/hosting/dedicated-servers/"
}

backup_du_hypernova_or_dedic_recommendations() {
  echo "Additionally, you can consider upgrading to an Advanced-level Dedicated server with 500 GB of remote storage.\nYou can find a list of such servers here: https://www.namecheap.com/hosting/dedicated-servers/our-prices/?categories=advanced_level&sort=cheap ."
}

vps_pulsar_du_recommendations() {
  echo "Additionally, you can consider upgrading to the VPS Quasar plan with 120GB of disk space. You can find the tech specs for it here:\nhttps://www.namecheap.com/hosting/vps/"
}

vps_quasar_du_recommendations() {
  echo "Additionally, you can consider upgrading to the VPS Magnetar plan with 240GB of disk space. You can find the tech specs for it here:\nhttps://www.namecheap.com/hosting/vps/"
}

vps_magnetar_du_recommendations() {
  echo "Additionally, you can consider upgrading to the VPS Hypernova plan with 500GB of disk space. You can find the tech specs for it here:\nhttps://www.namecheap.com/hosting/vps/"
}

vps_hypernova_or_dedic_du_recommendations() {
  echo "Additionally, you can consider upgrading to a dedicated server with more disk space:\nhttps://www.namecheap.com/hosting/dedicated-servers/our-prices/"
}

suggest_remote_backup_storage() {
  echo "- as most of the disk space is used by the server backups, we can suggest upgrading to the Complete management plan that offers a separate partition for backups.\nYou can check what is included in it here:\nhttps://www.namecheap.com/support/knowledgebase/article.aspx/9304/48/what-vps-management-options-do-you-provide/\nhttps://www.namecheap.com/support/knowledgebase/article.aspx/9213/2188/what-dedicated-server-management-options-do-you-provide/"
}

tmp_dir_filled_with_mysql_tmp_files(){
  local mysql_conf=$1;
  local mysqltmp=$2;

  echo "Most disk usage on the /tmp partition was caused by temporary files of the MySQL service.\nTo prevent the MySQL service from failing, we have moved the MySQL temporary directory to a new location:\n${mysqltmp}\nIn case you would like to use a different directory, you can update the 'tmpdir=/var/lib/mysql/tmp' line accordingly in the '$mysql_conf' file and restart the MySQL service with the following command:\n/scripts/restartsrv_mysql";
}

tmp_usage_general_recommendations(){
  [[ $(management_type_check) == "$COMPLETE" ]] && person='we' || person='you'
  echo "As one of the options for dealing with high /tmp disk usage, $person can set up the tmpwatch service so that temp files are deleted automatically on schedule:\nhttps://support.cpanel.net/hc/en-us/articles/360052677654-How-to-clean-your-tmp-directory-with-tmpwatch"
}
