How to copy / backup Sentora to a standby host using rsync

For those of you that use Sentora control panel for web hosting, the task of backing up or syncing your installation can be a little tricky. These scripts will aid you with the process of copying an entire Sentora installation to another server, which can be used as a standby / backup server or in a High Availability configuration.


  • You are running Sentora in the standard configuration on a Linux server (primary)
  • You have a second Linux server, also running Sentora (standby)
  • You have the ability to ssh / rsync from the primary server to the standby server.


If you are using Sentora for your DNS support, it is best if you use a floating IP address that can be moved to your standby servers. If the floating IP is referenced in your DNS entries, the same entries can be used for both primary and standby servers. If the IP of the local server is used, the standby server DNS entries will need to me modified before it can be used as the new primary server

How it works

The scripts will , via ssh, stop the running instance of MariaDB on the standby server and then perform the same task on the local server. This is done so that the database files are cleanly closed for copy. The Sentora directories (including databases, configs, plugins, etc) are copied to the remote server via ssh rsync. The web content is copied using the same method as well. As soon as the copy is completed, the local MariaDB instance is started, followed by the remote instance. There is downtime while the copy occurs, but after the initial sync, only the changed files are copied so it should take less time.

The Script

To use this script, replace the remoteServer and remoteUser variables with your standby server information and execute it on the primary server. Note: This script is lite. Future versions will do more error checking and send notifications. Feel free to take it and add to it!

 # Sentora rsyc to backup / standby server
 # Author: John Martin
 # Website:
 # Update this section with your server and user information
 # stop databases
 echo "Stopping local database server..."
 systemctl stop mariadb
 echo "done."
 echo "stopping remote database server"
 ssh -p 2112 $remoteUser@$remoteServer 'systemctl stop mariadb'
 echo "done."
 # rsync files to remote server
 echo "performing filesystem sync..."
 rsync -avz --rsh='ssh -p 2112' /var/sentora $remoteUser@$remoteServer:/var/
 rsync -avz --rsh='ssh -p 2112' /etc/sentora $remoteUser@$remoteServer:/etc/
 echo "done."
 # copying all databases to remote server
 # note - you can edit the rsync to only copy the specific databases that you want
 # this will overwrite the databases on the remote server
 echo "performing database sync..."
 rsync -avz --rsh='ssh -p 2112' /var/lib/mysql $remoteUser@$remoteServer:/var/lib/
 echo "done."
 # copy complete, start database services
 echo "starting local database server..."
 systemctl start mariadb
 echo "done."
 echo "starting remote database server..."
 ssh -p 2112 $remoteUser@$remoteServer 'systemctl start mariadb'
 echo "done."
 echo "sync complete!"

Leave a Reply