Unable to delete archived emails even with script /usr/local/cpanel/scripts/email_archive_maintenance appears to be running at PID '0'

asteresatic

Registered
Mar 31, 2020
3
0
1
Spain
cPanel Access Level
Root Administrator
Hi,
We have a serious and urgent problem of storage in our server. We are at 82% of capacity and climbing up.
We have 35GB/44Gb, of which 14Gb are archived emails I can't delete even with the script line I Found in the other threads.
When I use it in a cron job, the sistem says:
Another instance of /usr/local/cpanel/scripts/email_archive_maintenance appears to be running at PID '0'.

Am I doing anything wrong?
Thank you
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,251
313
Houston
Hello,

The archive should be removed automatically depending on your retention settings per email account.

You can manually remove archives. From the documentation on this:

Manage Disk Usage
You can delete messages from the archives to free up disk space.

To delete messages from the archives, perform the following steps:

  1. Click Access Webmail for the domain that you wish to manage. The Webmail interface will appear.
  2. In the top-right corner of the interface, click your archive’s email address. The User Preferences menu will appear.
  3. Click Manage Disk Usage. The Manage Disk Usage interface will appear.
  4. Click Manage for the mailbox that you wish to manage.
  5. In the Messages to delete menu, select the message filter that you wish to use:
    • 1 year or more.
    • 30MB in size or more.
    • Previously viewed.
    • All messages.
    • Custom query. — This option allows you to use Dovecot query language to make your own filter.
  6. Click Delete Permanently. A success message will appear.


doveadm-expunge will also do this:

[[email protected] ~]# man doveadm-expunge

-D Enables verbosity and debug messages.

-o setting=value

Overrides the configuration setting from /etc/dovecot/dovecot.conf and from the userdb with the given value. In order to override multiple settings, the -o option may be specified multiple times.​

-v Enables verbosity, including progress counter.

Command specific options:

-A If the -A option is present, the command will be performed for all users. Using this option in combination with system users from userdb { driver = passwd } is not recommended, because it contains also users with a lower UID than the one configured with the first_valid_uid setting.

When the SQL userdb module is used make sure that the iterate_query setting in /etc/dovecot/dovecot-sql.conf.ext matches your database layout. When using the LDAP userdb module, make sure that the iterate_attrs and iterate_filter settings in /etc/dovecot/dovecot-ldap.conf.ext match your LDAP schema. Otherwise doveadm(1) will be unable to iterate over all users.​

-F file

Execute the command for all the users in the file. This is similar to the -A option, but instead of getting the list of users from the userdb, they are read from the given file. The file contains one username per line.

-d Delete the mailbox if it is empty after expunging.

-S socket_path

The option's argument is either an absolute path to a local UNIX domain socket, or a hostname and port (hostname:port), in order to connect a remote host via a TCP socket.

This allows an administrator to execute doveadm(1) mail commands through the given socket.

-u user/mask

Run the command only for the given user. It's also possible to use '*' and '?' wildcards (e.g. -u *@example.org).

When neither the -A option, nor the -F file option, nor the -u user was specified, the command will be executed with the environment of the currently logged in user.

ARGUMENTS

search_query

Expunge messages matching this search query. See doveadm-search-query(7) for details.

EXAMPLE

This example expunges messages from Spam mailbox that were saved/copied there more than two weeks ago:

Code:
       doveadm expunge -u [email protected] mailbox Spam savedbefore 2w
REPORTING BUGS

Report bugs, including doveconf -n output, to the Dovecot Mailing List <[email protected]>. Information about reporting bugs is available at: Bugreport Mail


SEE ALSO


doveadm(1), doveadm-fetch(1), doveadm-purge(1), doveadm-search(1), doveadm-search-query(7)

That archive maintenance script should not be running as PID 0 also which I find odd. What is the output of
Code:
 ps faux |grep archive
 

asteresatic

Registered
Mar 31, 2020
3
0
1
Spain
cPanel Access Level
Root Administrator
Thank you for your reply.

I have been checking every single one of our 78 user accounts in 'emal disk usage', and none of them has an archive folder more than a few Mb (only one account has 1Gb). They must add something around 2Gb, nothing close to our 14 Gb of archived emails. I am not sure where this extra 12Gb could be stored, I really can't find them.

Something really weird that is happening is that I try to 'Download Archive' from my domain (using archive option through cpanel), which is supposed to have 13,93 Gb, but the downloaded .zip file only has 22Mb or so (Screenshot attached). I have tried it selecting 'Forever' in the options on 'Archiving' column, but the same happened. it is like that 14 Gb are lost somewhere. In the screenshot I had already changed it to no archived emails.

Thank you.
 

Attachments

Last edited:

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,251
313
Houston
Hi @asteresatic


The information I'm trying to obtain wouldn't be possible to get through the UI. Since your profile notes that you have root access to the server, I'd suggest you open a ticket with our support so that we can look into the issue further for you.