+
+# First, we find out if any domains have been removed from the
+# database but not from the filesystem.
+begin
+ # Get the list of domains according to the filesystem.
+ fs_domains = dms.get_domains_from_filesystem()
+rescue StandardError => e
+ puts "There was an error retrieving domains from the filesystem: #{e.to_s}"
+ Kernel.exit(ExitCodes::FILESYSTEM_ERROR)
+end
+
+begin
+ # ...and according to the Postfixadmin database.
+ db_domains = pgadb.get_domains_from_db()
+rescue DatabaseError => e
+ puts "There was an error connecting to the database: #{e.to_s}"
+ Kernel.exit(ExitCodes::DATABASE_ERROR)
+end
+
+
+# Then, we get the list of accounts that have been removed. We did
+# the domains first so that, if a domain was removed, we can avoid
+# reporting each of its accounts individually.