File: //usr/local/bin/eig_cache_enable
#!/bin/bash
_domain=$1
_user=$(whoami)
_home_dir=$(getent passwd ${_user} | awk -F: {'print $6'})
_base_path="${_home_dir}/.cpanel/proxy_conf"
if [[ -z ${1+x} || -z ${_user+x} || ${_user} == 'root' ]]; then
exit 1
elif [[ -d "${_home_dir}" ]]; then
_path_owner=$(stat -c '%U' "${_home_dir}")
if [[ "${_user}" != "${_path_owner}" ]]; then
exit 1
fi
fi
if [[ ! -d "${_base_path}" ]]; then
mkdir -p "${_base_path}"
fi
echo 'cache_level=2' > "${_base_path}/${_domain}"
touch "/etc/proxy_notify/${_user}"