Update script for backupSynologyMac
This commit is contained in:
		@@ -1,26 +1,37 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MEGA_VOLUME="/Volumes/Mega"
 | 
					MEGA_VOLUME="/Volumes/MEGA"
 | 
				
			||||||
MEGA="$HOME/MEGA"
 | 
					MEGA="$HOME/MEGA"
 | 
				
			||||||
STARTED="$HOME/.config/backup-started-$(date +%d-%m)"
 | 
					STARTED="$HOME/.config/backup-started-$(date +%d-%m)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function main(){
 | 
					function main(){
 | 
				
			||||||
	if [[ ! -e "$STARTED" ]]
 | 
						if [[ ! -e "$STARTED" ]]
 | 
				
			||||||
	then
 | 
						then
 | 
				
			||||||
 | 
							echo -e "[LOG] $(date) Started $HOME/Documents/Collage/Semestr2 ->\
 | 
				
			||||||
 | 
					$MEGA/Documents/Collage/Semestr2"
 | 
				
			||||||
 | 
							rsync --bwlimit=2048 --update --progress -r \
 | 
				
			||||||
 | 
								--exclude '*.mp4' --exclude '*.mkv'\
 | 
				
			||||||
 | 
								"$HOME/Documents/Collage/Semestr2/"\
 | 
				
			||||||
 | 
								"$MEGA/Documents/Collage/Semestr2/"
 | 
				
			||||||
 | 
							echo -e "[LOG] $(date) Ended $HOME/Documents/Collage/Semestr2 ->\
 | 
				
			||||||
 | 
					$MEGA/Documents/Collage/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		touch "$STARTED" && echo -e "[LOG] $(date) Created the file $STARTED"
 | 
							touch "$STARTED" && echo -e "[LOG] $(date) Created the file $STARTED"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		echo -e "[LOG] $(date) Started $HOME/.ssh/ -> $MEGA/ssh"
 | 
							echo -e "[LOG] $(date) Started $HOME/.ssh/ -> $MEGA/ssh"
 | 
				
			||||||
		rsync --bwlimit=1024 --update --progress -r "$HOME/.ssh/" "$MEGA/ssh/"
 | 
							rsync --bwlimit=2048 --update --progress -r "$HOME/.ssh/" "$MEGA/ssh/"
 | 
				
			||||||
		echo -e "[LOG] $(date) Finished $HOME/.ssh/ -> $MEGA/ssh"
 | 
							echo -e "[LOG] $(date) Finished $HOME/.ssh/ -> $MEGA/ssh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		echo -e "[LOG] $(date) Started $HOME/.gnupg/ -> $MEGA/gnupg"
 | 
							echo -e "[LOG] $(date) Started $HOME/.gnupg/ -> $MEGA/gnupg"
 | 
				
			||||||
		rsync --bwlimit=1024 --update --progress -r "$HOME/.gnupg/" "$MEGA/gnupg/"
 | 
							rsync --bwlimit=2048 --update --progress -r "$HOME/.gnupg/" "$MEGA/gnupg/"
 | 
				
			||||||
		echo -e "[LOG] $(date) Finished $HOME/.gnupg/ -> $MEGA/gnupg"
 | 
							echo -e "[LOG] $(date) Finished $HOME/.gnupg/ -> $MEGA/gnupg"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [[ -e "$MEGA_VOLUME" ]]
 | 
							if [[ -e "$MEGA_VOLUME" ]]
 | 
				
			||||||
		then
 | 
							then
 | 
				
			||||||
			echo -e "[LOG] $(date) Started $MEGA -> $MEGA_VOLUME"
 | 
								echo -e "[LOG] $(date) Started $MEGA -> $MEGA_VOLUME"
 | 
				
			||||||
			rsync --bwlimit=1024 --update --progress -r "$MEGA/" "$MEGA_VOLUME/"
 | 
								rsync --bwlimit=2048 --update --progress -r --exclude '.DS_Store' \
 | 
				
			||||||
 | 
									--exclude 'Icon*' \
 | 
				
			||||||
 | 
									"$MEGA/" "$MEGA_VOLUME/"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			echo -e "[ERROR] The folder $MEGA_VOLUME does NOT exist"
 | 
								echo -e "[ERROR] The folder $MEGA_VOLUME does NOT exist"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user