This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Lsyncd ===== Install required libraries: <code> apt-get install lsyncd echo 'fs.inotify.max_user_watches=400000' > /etc/sysctl.d/99-lsyncd.conf sysctl -p /etc/sysctl.d/99-lsyncd.conf </code> Create the sync directories on both servers: <code> mkdir /home/moodle mkdir /home/moodledata chmod 775 /home/moodle chmod 775 /home/moodledata </code> Create the user: <code> useradd lsyncd mkdir /home/lsyncd chown lsyncd:lsyncd /home/lsyncd usermod -aG www-data lsyncd </code> On server1: <code> su - lsyncd ssh-keygen </code> On server2: <code> su - lsyncd mkdir /home/lsyncd/.ssh chmod 700 /home/lsyncd/.ssh touch /home/lsyncd/.ssh/authorized_keys chmod 600 /home/lsyncd/.ssh/authorized_keys </code> Copy key from server1 /home/lsyncd/.ssh/id_rsa.pub to server2 /home/lsyncd/.ssh/authorized_keys. Create Lsyncd configuration on server1: <code> touch /etc/lsyncd.conf touch /etc/lsyncd.exclude chown lsyncd:lsyncd /etc/lsyncd.conf chown lsyncd:lsyncd /etc/lsyncd.exclude touch /var/log/lsyncd.log touch /var/log/lsyncd-status.log chown lsyncd:lsyncd /var/log/lsyncd.log chown lsyncd:lsyncd /var/log/lsyncd-status.log </code> Content of /etc/lsyncd.conf: <code> settings { logfile = "/var/log/lsyncd.log", statusFile = "/var/log/lsyncd-status.log", statusInterval = 20, maxProcesses = 1 } sync { default.rsyncssh, source="/home/moodle", host="lsyncd@192.168.122.135", excludeFrom="/etc/lsyncd.exclude", targetdir="/home/moodle", rsync = { archive = true, compress = false, whole_file = false }, ssh = { port = 22 } } </code> Create a systemd unit to start automatically with the following name /etc/systemd/system/lsyncd-moodle.service <code> [Unit] Description=Live Syncing (Mirror) Daemon After=network.target [Service] User=lsyncd Group=lsyncd Restart=always Type=simple Nice=19 ExecStart=/usr/bin/lsyncd -nodaemon -pidfile /run/lsyncd.pid /etc/lsyncd.conf ExecReload=/bin/kill -HUP $MAINPID PIDFile=/run/lsyncd.pid [Install] WantedBy=multi-user.target </code> Reload systemd and enable lsyncd-moodle: <code> systemctl daemon-reload systemctl enable lsyncd-moodle systemctl start lsyncd-moodle </code> ==== References ==== * https://download.moodle.org/download.php/stable404/moodle-4.4.1.tgz * https://developers.redhat.com/blog/2018/11/02/how-to-manually-copy-ssh-keys-rhel * https://github.com/lsyncd/lsyncd#readme * https://docs.rockylinux.org/guides/backup/mirroring_lsyncd/