Add exclude=.rvm to rsnapshot backup.

This commit is contained in:
BoHung Chiu 2023-10-03 21:45:45 +08:00
parent 240729cca6
commit 210d903395
1 changed files with 2 additions and 2 deletions

View File

@ -376,11 +376,11 @@ sudo sed -i 's/snapshot_root.*/snapshot_root\t\/home\/backup\/orbit/g' /etc/rsna
sudo sed -i 's/^\(backup\t.*\)/#\1/g' /etc/rsnapshot.conf
matched_backup_home=$(grep -P "backup\t$HOME" /etc/rsnapshot.conf|xargs)
if [ -z $matched_backup_home ]; then
sudo sed -i "$(echo "s/^\(#backup\t\/home\/\t\)/backup\t$(echo $HOME|sed 's/\//\\\//g')\tlocalhost\/\n\1/g")" /etc/rsnapshot.conf
sudo sed -i "$(echo "s/^\(#backup\t\/home\/\t\)/backup\t$(echo $HOME|sed 's/\//\\\//g')\tlocalhost\/\texclude=.rvm\n\1/g")" /etc/rsnapshot.conf
else
matched_backup_home=$(grep -P "(^|\s+)backup\t$HOME" /etc/rsnapshot.conf|xargs)
if [ -z $matched_backup_home ]; then
sudo sed -i "$(echo "s/[#\s\t]*backup\t$(echo $HOME|sed 's/\//\\\//g')/backup\t$(echo $HOME|sed 's/\//\\\//g')/g")" /etc/rsnapshot.conf
sudo sed -i "$(echo "s/[#\s\t]*backup\t$(echo $HOME|sed 's/\//\\\//g')\t\([^ \t]\+\).*/backup\t$(echo $HOME|sed 's/\//\\\//g')\t\1\texclude=.rvm/g")" /etc/rsnapshot.conf
fi
fi
sudo wget -nc http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/orbit_logrotate -O /etc/logrotate.d/orbit