Simple Automating MySQL Database Backups
#!/bin/bash
# Database credentials
DB_USER="your_username"
DB_PASSWORD="your_password"
DB_NAME="your_database_name"
# Backup directory
BACKUP_DIR="/path/to/backup/directory"
# Timestamp (to create unique backup filenames)
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
# Create backup directory if it doesn't exist
mkdir -p $BACKUP_DIR
# Backup the MySQL database
mysqldump -u$DB_USER -p$DB_PASSWORD $DB_NAME > $BACKUP_DIR/$DB_NAME-$TIMESTAMP.sql
# Compress the backup
gzip $BACKUP_DIR/$DB_NAME-$TIMESTAMP.sql
# Optionally, you can remove backups older than a certain period
# find $BACKUP_DIR -type f -name "*.gz" -mtime +7 -exec rm {} \;
echo "Backup completed: $BACKUP_DIR/$DB_NAME-$TIMESTAMP.sql.gz"
What all scripts or methods do you guys use to backup your SuiteCRM database?
1 Like
I pretty much always install in WHM/Cpanel environment and just add the installation to installatron and have installatron make and maintain regular backups. That’s the easiest. I also find WHM/Cpanel environment is rock solid for SuiteCRM. Very few server issues and problems for hosting SuiteCRM.
2 Likes
On my side we do a daily backup via Proxmox, never gave any issue and if needed can just revert XD
1 Like
Paul, how much does that service cost monthly, if I may ask?
I usually use Godaddy its like 20 bucks a month for the vps and 20 bucks a month for the whm/cpanel. Of couse you can scale up the vps as much as you want. It can also work on cpanel shared hosting for like 20 bucks s month, but its not ideal because you can’t really get fully verified email on shared hosting. So when you consider unlimited self hosted emails, SuiteCRM and also your website hosted plus free auto SSL for all three for like 40 usd a month its pretty good. I imagine there are even cheaper vps options out there. On my todo list is try AWS free tier for SuiteCRM. I’ve already set up a free instance for n8n and its pretty good.
A Godaddy vps with cpanel could probably also host a dozen or so SuiteCRM installs/hosting accounts so you could even resell your own vps as dedicated SuiteCRM hosting as a business if you like.
2 Likes
Are you planning to self host everything(suitecrm, db, ssh cert) or you’re trying to use something like below?
I was planning on trying both.
Is this not a good solution? Just trying to understand why to spend some bucks when we have this script to be used as a cronjob. Thanks!
It’s a good solution, but I’m wondering if there are better ways to do it.
1 Like