Pre-Save Script
The pre-save script are run before project directories are saved. To add or modify, click the Settings icon in the left sidebar and locate the Presave Script section:
Pre-Save Script setting
The pre-save script runs as Bash and must complete in under 15 seconds. Script runs from /tmp directory.


Pre-save scripts are useful for database courses. Here is an example:
sudo mysqldump --databases {{database}} > /home/nt-user/workspace/.dump.sql
This is useful because only files in a project are backed up (not the entire sandbox environment), so in order to save the database it must be saved as a file before the files are saved.
There is another way you can persist MySQL database states covered here.
Copy link