wrote a script to sync my netbook music with my server music and everything was fine.
but if for some reason lets say i run it accidently and i'm not connected to my network, i just wiped my netbook music
here's what i got so far:
Code:
Sudo mkdir /media/ServerMusic/
mount -t cifs -o user=Justin,password=****** //192.168.1.108/Public-3/Music/ /media/ServerMusic/
rsync -v -P --delete --min-size=500 -r -u /media/ServerMusic/ /home/forbees/Music/
umount /media/ServerMusic/
rm -r /media/ServerMusic/
i need to have the --delete option in rsync (say i sync it and realize i hate some music, when i delete it from the server i don't want it still on the netbook
i want an if statement in here somehow, but i'm not sure how to do it
something like, the first command in the script should be a ping test, if ping doesn't work end the script, if ping does work continue
ooorrrrr, if the server music gets mounted to the created directory continue, if the mount failed, or even in the mounted folder is empty stop the script
what can i do here to ensure i can keep the --delete and not have to worry about losing my music if the mount fails?
Bookmarks