Home | FAQ | Manual | Ezmlm Manual Pages | Qmail Manual Pages | Readme | Upgrade | Downgrade

Converting to and from and SQL database - ezmlm-idx FAQ

Next: , Previous: Manually manipulating the subscribers of a SQL-enabled list, Up: ezmlm support for SQL databases

5.6 Converting to and from and SQL database

Just like other programs, ezmlm-list(1), ezmlm-sub(1), and ezmlm-unsub(1) will work with normal address databases in the absence of DIR/sql. However, they also have a -M switch to force this behavior even in the presence of DIR/sql. This is used to convert an address database from the standard type to the SQL type:

     % ezmlm-list -M dir | xargs ezmlm-sub dir

or from the SQL version to the standard type:

     % ezmlm-list dir | xargs ezmlm-sub -M dir

To synchronize the two, remove one and then update it with ezmlm-sub(1) from the other. Alternatively, sort the ezmlm-list(1) output for both, use diff and sed/awk to get separate files of the differences, and use ezmlm-sub(1) and ezmlm-unsub(1) to apply the differences to the appropriate database.

This type of conversion can serve as a convenient means to convert a list from one type to another, to back up databases, and to move subscriber addresses from a standard list to a SQL table for other purposes, or from a SQL database to a standard mailing list (you may need to use addresses from a SQL table, without wanting your lists to be dependent on an SQL server for day to day operation).

Note: This inter-conversion requires the DIR/sql file. If you do not run the list against an SQL server, you need to disable deliveries before you temporarily create this file. Otherwise, the list will run against the SQL database during the time DIR/sql exists.