Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+9 votes
in Q2A Core by
edited by

Hi guys I have created Q2A database/files/folders import export script. Just move the script in root directory of q2a, give chmod permission and run it. 

Here you have it,

export : https://gist.github.com/theDemon92/8b43653e43dc86c6c70a60d8e615cdaf

import : https://gist.github.com/theDemon92/1befdc50344e503fe3d61b122132e558

I would like to request Q2A developers to integrate these script in next release of Q2A as a plugin, which can export or import the site in background. Thanks in advance

Q2A version: 1.8.6
You may want to add --opt (https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#option_mysqldump_opt) to the mysqldump command, and maybe also --routines, --triggers, and --force for good measure. And the default port for MySQL is 3306, not 22 (SSH).
Prompting for user input in a backup script is not a good practice in general, b/c you normally want to run backups automatically on a schedule, not interactively. Hence it's better to read the information from a config file (e.g. by dot-sourcing). Of course you'd  need to add error handling and logging for scheduled runs as well.
Also, mixing installation and backup in one script may be convenient, but it's a bad practice b/c the former needs to be done just once, whereas the latter is a repeated operation. And most importantly, running "curl | bash" is a TERRIBLE practice. NEVER do that.

Please log in or register to answer this question.