I recently wanted to be able to automate a mysqldump statement from Eclipse using Apache Ant. I’m guessing this code could be cleaned up some to better handle the command line arguments, so if somebody can let me know how it can be cleaned up I’m all ears. However, this worked so I went with it.
Also, I created a ZIP archive of the resulting dump statement.
<property name="local_database_host" value="localhost" /> <property name="local_database_username" value="root"/> <property name="local_database_password" value="password" /> <property name="local_database_name" value="bzftp_beta"/> <property name="backup_directory" value="C:/Databases/" /> <property name="backup_file" value="bzftp_beta" /> <target name="createDBArchive" description="-->> Create database dump archive file"> <exec dir="" executable="C:/xampp/mysql/bin/mysqldump.exe"> <arg line='-u "${local_database_username}" -r "${backup_directory}${backup_file}.sql" ${local_database_name} jos_categories jos_sections jos_content jos_content_frontpage jos_content_rating jos_components jos_menu jos_modules jos_templates_menu' /> </exec> <zip destfile="${backup_directory}${backup_file}.sql.zip" update="true"> <fileset dir="${backup_directory}"> <include name="${backup_file}.sql"/> </fileset> </zip> </target>

0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.