![]() |
![]() |
![]() |
![]() |
![]() |
Some examples of scripts that I use to backup a remote server or to synchronize data between two PCs.
draft ...
#!/bin/sh SERVER_USER=root@yourdomanin.dom # backup of entire filesystem #DIR_LIST="/bin /boot /etc /home /lib /lib64 /lost+found /opt /root /sbin /selinux /srv /usr /var" # backup main working directories DIR_LIST="/srv /var /home" DATE_BACKUP=`date +%y%m%d` if [ ! -d ./logs ] ; then mkdir ./logs fi rsync -aloprz --numeric-ids --delete --force --log-file ./logs/rsync-$DATE_BACKUP.log $SERVER_USER:"$DIR_LIST" .
Note: --numeric-ids is an important switch: it ensures that copied files maintains the association between user names and numeric ids (they may vary between Linux distro).