In this article we are picking up where we left off, we now have the ability to connect from our primary server to our secondary server without the need to enter a password with the help of a secret key. If you are lost at this point please refer to the last article Syncing a failover website : Creating an SSH key. At this point all we need to do is setup the bash script. We will create the script to log all of its activity so that we know if the process is having problems. The log file will be kept in a directory on the primary server. You will need to know the absolute path to this file and the file must be writable and readable by the system, so a chmod of 755 or 777 should do the trick.
#!/bin/bash echo Sync started `date` >> /Volumes/Logs/Sync_log.txt echo "Now starting rsync"
At this point we are ready for the sync to start, we will start by syncing the files from the primary server to the secondary server. This is a one way sync, whatever we add to the primary server will be copied over to the secondary server. Whatever is deleted from the primary server will also be deleted from the secondary server we accomplish this via the use of rsync. Read more..