HEX
Server: Apache/2
System: Linux nexus-01 4.18.0-553.120.1.el8_10.x86_64 #1 SMP Mon Apr 20 18:04:27 EDT 2026 x86_64
User: aglcoke (1118)
PHP: 8.2.31
Disabled: mail,exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/directadmin/sync_mail_quotas.sh
#!/bin/bash
#############################################
# Sync Quota Limits to /home/mail Partition
# Run on DirectAdmin server
#
# Copies quota limits from /home to /home/mail
# so both partitions enforce the same limits
#############################################

echo "==========================================="
echo "Sync Quota Limits: /home -> /home/mail"
echo "==========================================="

SYNCED=0
SKIPPED=0

# Get all users with quotas on /home
repquota -u /home | tail -n +6 | while read user status blocks soft hard grace files fsoft fhard fgrace; do
    # Skip header/empty lines
    [ -z "$user" ] && continue
    [[ "$user" == "#"* ]] && continue
    [[ "$user" == "root" ]] && continue
    [[ "$user" == "nobody" ]] && continue

    # Remove -- or +- status indicator from user if attached
    user=$(echo "$user" | sed 's/[-+]$//')

    # Skip if no limit set on /home
    if [ "$soft" -eq 0 ] && [ "$hard" -eq 0 ]; then
        continue
    fi

    # Check if user has directory on /home/mail
    if [ ! -d "/home/mail/$user" ]; then
        continue
    fi

    # Set same limits on /home/mail
    setquota -u "$user" "$soft" "$hard" "$fsoft" "$fhard" /home/mail 2>/dev/null

    if [ $? -eq 0 ]; then
        echo "[OK] $user - soft:${soft}KB hard:${hard}KB"
        ((SYNCED++))
    else
        echo "[FAIL] $user"
    fi
done

echo ""
echo "==========================================="
echo "Sync Complete"
echo "==========================================="
echo ""
echo "Verify with:"
echo "  repquota -u /home/mail | head -30"