How to backup/restore RoundCube settings in DA

DirectAdmin control panel provides two utlities for backing up and restoring RoundCube settings. The paths of the script are:

/usr/local/directadmin/scripts/backup_roundcube.php
/usr/local/directadmin/scripts/restore_roundcube.php

Info from the backup script:

[root@web ~]# /usr/local/directadmin/scripts/backup_roundcube.php
Roundcube 0.1 backup script to backup Users.

Usage:
  username=username domain=domain.com xml_file=/path/to/rc.xml /usr/local/directadmin/scripts/backup_roundcube.php

The script will output XML of all current email accounts stored in roundcube,
for the given domain.
[root@web ~]#

Info from the restoration script:

[root@web /]# /usr/local/directadmin/scripts/restore_roundcube.php
Roundcube 0.1 restore script to restore Users.

Usage:
  username=username domain=domain.com xml_file=/path/to/rc.xml /usr/local/directadmin/scripts/restore_roundcube.php

The script will read in the XML specified by xml_file.
It will insert the data into the  database.
[root@web /]#

Command example to use for backup:

username=plothost domain=testplothost.com xml_file=file.xml /usr/local/directadmin/scripts/backup_roundcube.php

Command example to use for restoration:

username=plothost domain=testplothost.com xml_file=file.xml /usr/local/directadmin/scripts/restore_roundcube.php

The generated XML file looks like this:

<ROUNDCUBE>
	<EMAIL>
		<USERNAME>user1%40testplothost.com</USERNAME>
		<LANGUAGE>en_US</LANGUAGE>
		<PREFERENCES>a%3A7%3A%7Bs%3A4%3A%22skin%22%3Bs%3A5%3A%22larry%22%3Bs%3A14%3A%22message_extwin%22%3Bi%3A0%3Bs%3A18%3A%22message_show_email%22%3Bb%3A1%3Bs%3A14%3A%22mail_read_time%22%3Bi%3A5%3Bs%3A16%3A%22message_sort_col%22%3Bs%3A4%3A%22date%22%3Bs%3A11%3A%22client_hash%22%3Bs%3A16%3A%22CyIB4Qq6Iwc2hTFj%22%3Bs%3A9%3A%22junk_mbox%22%3Bs%3A4%3A%22Junk%22%3B%7D</PREFERENCES>
		<CREATED>2022-03-11+08%3A28%3A54</CREATED>
		<LAST_LOGIN>2022-03-11+08%3A28%3A54</LAST_LOGIN>
		<INDENTITIES>
			<INDENTITY>
				<EMAIL>user1%40testplothost.com</EMAIL>
				<STANDARD>1</STANDARD>
				<NAME>User1</NAME>
				<CHANGED>2022-03-11+08%3A28%3A54</CHANGED>
				<ORGANIZATION>PlotHost</ORGANIZATION>
				<REPLY-TO></REPLY-TO>
				<BCC></BCC>
				<SIGNATURE>Best Regards</SIGNATURE>
				<HTML_SIGNATURE>0</HTML_SIGNATURE>
			</INDENTITY>
		</INDENTITIES>
		<CONTACTS>
		</CONTACTS>
	</EMAIL>
</ROUNDCUBE>

As we can see in the generated XML file, the scripts will save/restore RoundCube settings like Name, Organization, Signature, Reply-to, BCC, the Contacts list. It will also save interface settings, like language, sort column etc. The settings will be processed for all email accounts for a specific domain/username.

Leave a Reply