I just made this concrete5 auto-backup shell script.
This is simple shell script to back up your concrete5.7.x site. This is the script that runs on your server.
This script is licensed under The MIT License. USE IT AT YOUR OWN RISK.
- Go to GitHub and download
- Add your server config in
- If you don’t uncomment MYSQL_PASSWORD option, you will have to enter MySQL Password every time you run this script.
- Upload the
concrete5-backup.shto your server
- Change the file permission
chmod 700 concrete5-backup.shOr whatever the permission you need to execute the file. But make sure to minimize the permission.
- Run the sh file from ssh or set-up CRON job.
It’s is highly advised that you know what you’re doing with this script. You MUST have certain amount of knowledge of what shell script is.
CAUTION: Check your concrete5 folder.
This script first save the SQL dump file onto concrete5 directory. If the script fails, it may leave the SQL file under the server. MAKE SURE to check the server occasionally.
At default, you still need to enter the MySQL Password.
sh concrete5-backup.sh [1st option] [2nd option]
sh concrete5-backup.sh --all --relative
1st option will determine how much file you want to backup
back up a SQL and the files in application/files
- [no option]
back up only a SQL dump fule under WHERE_IS_CONCRETE5 path
back up a SQL and all files under WHERE_IS_CONCRETE5 path
back up a SQL, and the files in application/files, packages/
Shows all the help options.
You MUST specify 1st option if you want to specify 2nd option.
2nd option determine if you need to work as absolute path or relative path. A Mac OS User reported that they need to be specify absolute path. You may need to use the 2nd option if you’re running this as a cron job.
The shell runs relative path.
The shell always use absolute path when dumping and zipping files.
Once you download the sh file, you must change the where VARIABLES is from line 15
It would add current year, month, date, hour, and seconds to the backup files.
For example, if you think you don’t want to put all the minutes and second, remove
Enter the server full path where you want to save your backup files to.
HINT: If you don’t know where to find, use “pwd” command to find your current location of the server to find the full path of the server.
Enter the full server path of where your concrete5 site is installed
Enter the identical file name. This will be the prefix of your file.
Enter the MySQL server address.
Enter the name of your MySQL database.
Enter the MySQL username
If you don’t want to enter the password every time, uncomment the MYSQL_PASSWORD and enter the MySQL password.
--single-transactionoption added to MySQLdump comman (thanks Endo-san)
- 2nd option of relative path or absolute path added for Mac OS user (thanks Endo-san)
- database option added: option to only back-up the SQL dump file
- Some script validation using www.shellcheck.net
- Fix some English
- Fix where the ALL option generates error because it was indicating the same zip location twice.
- First version.