#!/bin/bash
basePath="/home/bu/Backup"
outputPath="/var/log/rsync"
# Script to backup important files to /dev/sda2.
echo "Backing up important files to /dev/sda2. Please wait.."
echo "" 2>&1 | tee -a ${outputPath}/rsync-output.txt
echo "-------------------------------------------------------------------------------" 2>&1 | tee -a ${outputPath}/rsync-output.txt
echo "$(date) $(ls -1 | wc -l)" >> ${outputPath}/rsync-output.txt
echo "-------------------------------------------------------------------------------" 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /var/www ${basePath}/var/ 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/motd ${basePath}/etc 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/ssh/sshd_config ${basePath}/etc/ssh/sshd_config 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/update-motd.d/10-uname ${basePath}/etc/update-motd.d 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/caddy/ ${basePath}/etc/caddy 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/ssl/ ${basePath}/etc/ssl 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/thelounge/ ${basePath}/etc/thelounge 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/samba/smb.conf ${basePath}/etc/samba 2>&1 | tee -a ${outputPath}/rsync-output.txt
rsync -av /etc/ssh/sshd-banner ${basePath}/etc/ssh 2>&1 | tee -a ${outputPath}/rsync-output.txt
echo "Backup Completed Successfully to /dev/sda2.."