backup-conf.sh

Bugfix: ajout —rsync-path=/bin/rsync pour clicclac.synology.me
This commit is contained in:
2019-11-03 11:55:47 +01:00
parent 399d4f0c04
commit cd94b75b32

View File

@@ -48,8 +48,8 @@ notification() {
}
copy() {
if [ -d $1 ]; then cp -R $1 $2; fi
if [ -f $1 ]; then cp $1 $2; fi
if [[ -d $1 ]]; then cp -R $1 $2; fi
if [[ -f $1 ]]; then cp $1 $2; fi
}
# Web: PHP / Apache / MySQL
@@ -79,57 +79,56 @@ done
BACKUP_MYSQL_FOLDER=$(echo $CURRENT_MYSQL | awk -F "-" '{print $2 " " $1}')
#if [ ! -d "mysql $CURRENT_MYSQL" ]; then mkdir "mysql $CURRENT_MYSQL"; fi
if [ ! -d "$BACKUP_MYSQL_FOLDER" ]; then mkdir "$BACKUP_MYSQL_FOLDER"; fi
cp /usr/local/etc/my.cnf "$dest_mamp/$BACKUP_MYSQL_FOLDER/"
cp -R /usr/local/etc/my.cnf.d "$dest_mamp/$BACKUP_MYSQL_FOLDER/"
tar -jcvf /tmp/mysql.tar.bz2 /usr/local/var/mysql/ && mv /tmp/mysql.tar.bz2 "$dest_mamp/$BACKUP_MYSQL_FOLDER/"
# Shell: bash / zsh
cd "$dest"
if [ ! -d "shell" ]; then mkdir "shell"; fi
dest_shell=$dest/shell/
cp $HOME/.bash_profile "$dest_shell"
cp $HOME/.bash_aliases "$dest_shell"
cp $HOME/.sh_aliases "$dest_shell"
cp $HOME/.zcompdump "$dest_shell"
cp $HOME/.zsh_plugins.sh "$dest_shell"
cp $HOME/.zsh_plugins.txt "$dest_shell"
cp $HOME/.zshrc "$dest_shell"
copy $HOME/.bash_profile "$dest_shell"
copy $HOME/.bash_aliases "$dest_shell"
copy $HOME/.sh_aliases "$dest_shell"
copy $HOME/.zcompdump "$dest_shell"
copy $HOME/.zsh_plugins.sh "$dest_shell"
copy $HOME/.zsh_plugins.txt "$dest_shell"
copy $HOME/.zshrc "$dest_shell"
# Autres
#copy $HOME/.backup_list.conf $dest
cp $HOME/.backup_list.conf "$dest"
cp -R $HOME/.config "$dest" # joplin, mpv, rclone, xnview
cp $HOME/.exclude-rsync "$dest"
cp $HOME/.gitconfig "$dest"
cp $HOME/.gitignore "$dest"
[ -d $HOME/.gnupg ] && cp -R $HOME/.gnupg "$dest"
cp -R $HOME/.gnupg_pre_2.1 "$dest"
cp -R $HOME/.iterm2 "$dest"
cp -R $HOME/.kymsu "$dest"
cp $HOME/.nanorc "$dest"
cp -R $HOME/.nanosyntax "$dest"
[ -f $HOME/.password.txt ] && cp $HOME/.password.txt "$dest"
cp -R $HOME/.ssh "$dest"
cp -R $HOME/.vnc "$dest"
copy $HOME/.backup_list.conf "$dest"
copy $HOME/.config "$dest" # folder (joplin, mpv, rclone, xnview)
copy $HOME/.exclude-rsync "$dest"
copy $HOME/.gitconfig "$dest"
copy $HOME/.gitignore "$dest"
copy $HOME/.gnupg "$dest" #folder
copy $HOME/.gnupg_pre_2.1 "$dest" #folder
copy $HOME/.iterm2 "$dest" #folder
copy $HOME/.kymsu "$dest" #folder
copy $HOME/.nanorc "$dest"
copy $HOME/.nanosyntax "$dest" #folder
copy $HOME/.password.txt "$dest"
copy $HOME/.ssh "$dest" #folder
copy $HOME/.vnc "$dest" #folder
cp /private/etc/hosts "$dest"
copy /private/etc/hosts "$dest"
cp -R $HOME/Library/Application\ Support/Transmit "$dest"
cp -R $HOME/Library/LaunchAgents "$dest"
cp $HOME/Documents/Scripts/kymsu2/plugins.d/Brewfile "$dest"
cp $HOME/Documents/Scripts/kymsu2/plugins.d/Installed_SilverBook*.md "$dest"
cp $HOME/Dropbox/Dash.dash "$dest"
[ -f $HOME/.wg++/WebGrab++.config.xml ] && cp $HOME/.wg++/WebGrab++.config.xml "$dest"
copy "$HOME/Library/Application\ Support/Transmit" "$dest" #folder
copy $HOME/Library/LaunchAgents "$dest" #folder
copy $HOME/Documents/Scripts/kymsu2/plugins.d/Brewfile "$dest"
copy $HOME/Documents/Scripts/kymsu2/plugins.d/Installed_SilverBook*.md "$dest"
copy $HOME/Dropbox/Dash.dash "$dest"
copy $HOME/.wg++/WebGrab++.config.xml "$dest"
terminal-notifier -title 'Backup configurations' -message 'Sauvegarde terminée !' -sound 'Glass'
server1="clicclac.synology.me:/volume1/Backup/SilverBook/"
rsync --exclude-from="$HOME/.exclude-rsync.txt" -zarvh "$dest/" bruno@$server1
rsync -e '/usr/bin/ssh -p 42666' --exclude-from="$HOME/.exclude-rsync.txt" --rsync-path=/bin/rsync -zarvh "$dest/" bruno@$server1
result=$?
notification "Backup configurations" "$server1" $result
server2="ftp.cluster011.ovh.net:www/backup/SilverBook/"