backup-conf.sh

-option contentImage pour terminal-notifier
-fonction copy
This commit is contained in:
2019-11-03 09:54:39 +01:00
parent 259fed4ab2
commit 399d4f0c04

View File

@@ -26,21 +26,32 @@ if [ "$1" == "-h" ]; then
exit 0
fi
BKP_BASE_DIR=$(dirname "$0")
# functions
notification() {
if [ $3 -eq 0 ];
then
sound="Glass"
message="Envoi terminé sur $2 !"
image="$BKP_BASE_DIR/success.png"
else
sound="Basso"
message="Echec lors de l'envoi sur $2 : erreur $result"
image="$BKP_BASE_DIR/error.png"
fi
if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then
terminal-notifier -title "$1" -message "$message" -sound "$sound"
terminal-notifier -title "$1" -message "$message" -sound "$sound" -contentImage "$image"
fi
}
copy() {
if [ -d $1 ]; then cp -R $1 $2; fi
if [ -f $1 ]; then cp $1 $2; fi
}
# Web: PHP / Apache / MySQL
CURRENT_APACHE=$(httpd -v | grep "version" | awk '{print $3}' | awk -F/ '{print $2}')
@@ -88,6 +99,7 @@ cp $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"
@@ -108,15 +120,10 @@ cp /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/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"
#
test_and_copy() {
}
#
terminal-notifier -title 'Backup configurations' -message 'Sauvegarde terminée !' -sound 'Glass'
server1="clicclac.synology.me:/volume1/Backup/SilverBook/"