October 28, 201510 yr Here is the script backup.sh #!/bin/bash #Created by Dennis Hosang 20130812 #day of week variable DOW=$(date +%A) #username variable USERNAME="netadm1n" #hostname variable HOST=$(hostname|cut -f1 -d.) #backup /home sudo rsync --delete -azvv --exclude-from '/backups/home_exclude' --log-file=/backups/${DOW}/rsync_log /home/ 10.6.56.244:/backups/${HOST}/${DOW}/home/ #backup /boot sudo rsync --delete -azvv --log-file=/backups/${DOW}/rsync_log /boot/ 10.6.56.244:/backups/${HOST}/${DOW}/boot/ #empty trash rm -rf /home/${USERNAME}/.local/share/Trash/Files/* #backup /root sudo rsync -avz --delete --exclude-from '/backups/root_exclude' --log-file=/backups/${DOW}/rsync_log / 10.6.56.244:/backups/${HOST}/${DOW}/root/ #backup /home #sudo rsync --delete -azvv --exclude-from '/backups/home_exclude' --log-file=/backups/${DOW}/rsync_log /home/ 10.6.56.244:/backups/${HOST}/${DOW}/home/ Just added it to my crontab # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command # 37 14 * * * root sh /backups/backup.sh
Create an account or sign in to comment