Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/opt/tier1adv/bin/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/tier1adv/bin/setmaxemails

#!/bin/bash
# sets maxemails for a user
# updated by vanessa v.  5/23/12

CPVER=$(cat /usr/local/cpanel/version  | cut -d. -f2)

function rebuild(){

        sudo /scripts/build_maxemails_config

	if [ "$CPVER" -lt 32 ];then
	        sudo /scripts/update_email_limits
	else
		sudo /scripts/updateuserdomains
	fi

}

# checks for input

if [ "$1" == "" ];
then
        echo ""
        echo "Missing user name..."
	exit 1
        echo ""

elif ! /bin/ls -A /var/cpanel/users/$1 > /dev/null;
then
    	echo ""
        echo "User does not exist"
	exit 1
        echo ""

elif [ "$2" == "" ];
then
        echo ""
        echo "You need to specify an hourly limit"
	exit 1
        echo ""

elif [ "$2" -gt "750" ];
then
        echo ""
        echo "You are not allowed to set maxemails higher than 750 - please ask a system admin"
	exit 1
        echo ""

elif  grep MAX_EMAIL_PER_HOUR /var/cpanel/users/$1 >/dev/null
then
        echo ""
	sed -e '/MAX_EMAIL_PER_HOUR/d' -i /var/cpanel/users/$1 >/dev/null
	echo "MAX_EMAIL_PER_HOUR=$2" >> /var/cpanel/users/$1
	rebuild
	echo "$1 enabled to send up to $2 emails per hour"
        echo ""

else
        echo ""
        echo "MAX_EMAIL_PER_HOUR=$2" >> /var/cpanel/users/$1
	rebuild
        echo "$1 added to sent up to $2 emails per hour"

fi

Zerion Mini Shell 1.0