Cleanup Maildir

Discussion in 'ISPConfig 3 Priority Support' started by Stelios, May 24, 2022.

  1. Stelios

    Stelios Active Member HowtoForge Supporter

    I found a howto with among others it has the following script to auto cleanup junk etc.

    Code:
    #!/bin/sh
    # Time to wait before removing mails from the Junk folder (Default: 7 days) Set 0 to turn off.
    junk_max_hours=$((24*7))
    # Time to wait before removing mails from the Trash folder (Default: 30 days) Set 0 to turn off.
    trash_max_hours=$((24*30))
    for domain in /var/www/*
    do
      if [ -d "$domain"/user ]
      then
        for user in $domain/user/*
        do
          if [ "$junk_max_hours" -gt "0" ]
          then
            if [ -d "$user/Maildir/.Junk" ]
            then
              tmpreaper -m $junk_max_hours $user/Maildir/.Junk/{cur,new}
            fi
          fi
          if [ "$trash_max_hours" -gt "0" ]
          then
            if [ -d "$user/Maildir/.Trash" ]
            then
              tmpreaper -m $trash_max_hours $user/Maildir/.Trash/{cur,new}
            fi
          fi
        done
      fi
    done
    How can I modify the script to work on a multi server setup? The above works only when email server is on the same server with web.

    Thanks
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This can not be a script for ISPConfig 3 and it can't work on ISPConfig 3 systems. Is it possible that you try to use a script for ISPConfig 2 on an ISPConfig 3 server?
     
  3. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Why not use the built-in functions in ISPConfig for this?
     

Share This Page