# 7. Running the Archiver¶

Archiving can be done for all users, all users on one primary server or on a per-user basis.

### 7.1.1. From the command line¶

The following command performs an archive run for all users:

kopano-archiver -A


Passing option --local-only to kopano-archiver tells it to archive only the primary stores that live on the server to which kopano-archiver is connected. Unless configured otherwise in the configuration file, this is the server on which kopano-archiver is run:

kopano-archiver -A --local-only


To run kopano-archiver for a specific user use the -u option:

kopano-archiver -u <user name> -A


It is recommended to perform an Archiver run every night. This can be done by adding the following line to /etc/crontab :

0 1 * * * root [ -x /usr/sbin/kopano-archiver ] && /usr/sbin/kopano-archiver -A


## 7.2. Cleanup¶

To keep the archive synchronized with primary stores after items are deleted from the primary store, start the archiver in cleanup mode. This is a separate operation from archiving. Since cleanup may be a long process, it is recommended to run it less often than archive operations.

When kopano-archiver performs a cleanup run in which it encounters messages that exist in an archive and for which in main store a stub used to present which has now been deleted, it will remove the message from the archive. This is useful to avoid the situation that archived messages exist which have properties set that indicate that they are stubbed, while no corresponding stub exists in main(store.)

What happens to such archived messages depends on configuration:

1. cleanup_action is set to delete. In this case messages for which no stubs exist will be removed from the archive.
2. cleanup_action is set to store. In this case messages for which no stubs exist will be moved to a folder named Kopano Archive\Deleted.

Note

Archiver can remove soft deleted items from the main store (or stores) for which a cleanup run is performed. This avoids the situation in which soft deleted stubs may be restored for which the archived versions no longer exist. To enable this feature, configuration item purge_soft_deleted must be set to yes. See chapter Softdelete restore in the Administrator Manual for more information on soft deleted items.

### 7.2.1. From the command-line¶

The following command performs a cleanup for all users:

kopano-archiver -C


Passing option --local-only to kopano-archiver causes it to cleanup only archives of users who have a store on the server to which kopano-archiver is connected. This is the server on which kopano-archiver is executed unless otherwise configured in the configuration file.

kopano-archiver -C --local-only


It’s also possible to explicitly specify which users archive to cleanup:

kopano-archiver -u <user name> -C


It’s recommended to perform the cleanup run once a week. This can be done by adding the following line to /etc/crontab.

0 3 * * 0 root [ -x /usr/sbin/kopano-archiver ] && /usr/sbin/kopano-archiver -C


This will clean up all archives every sunday at 3:00 am.