Weekly Redmine Production Database Backup » History » Version 1
Gareth Eaton, 05/27/2023 12:18 PM
1 | 1 | Gareth Eaton | h1. Weekly Redmine Production Database Backup |
---|---|---|---|
2 | |||
3 | To run the backup command automatically every week, you can set up a cron job. Here's how you can do it: |
||
4 | |||
5 | Open the cron table for editing by running the following command: |
||
6 | |||
7 | |||
8 | <pre> |
||
9 | crontab -e |
||
10 | </pre> |
||
11 | |||
12 | If prompted to select an editor, choose your preferred editor (e.g., nano, vim). |
||
13 | |||
14 | In the cron table, add the following line to schedule the backup to run every week: |
||
15 | |||
16 | <pre> |
||
17 | 0 0 * * 0 mysqldump -u redmineuser -pge8227104@NCB redminedb > /root/backups/redmine_production_backup_$(date +\%Y-\%m-\%d).sql |
||
18 | </pre> |
||
19 | |||
20 | This line specifies that the backup command should run at 12:00 AM (midnight) every Sunday (0 0 * * 0). The backup filename includes the current date. |
||
21 | |||
22 | Save the file and exit the editor. |
||
23 | |||
24 | The cron job is now scheduled to run automatically every week. The backup file will be created in the /root/backups directory with the current date appended to the filename. |