Documentation
Search…
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.

Example

Pre-save scripts are useful for database courses. Here is an example:
1
#!/bin/bash
2
sudo mysqldump --databases {{database}} > /home/nt-user/workspace/.dump.sql
Copied!
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.
Last modified 1yr ago
Copy link
Contents
Example