Everyone knows that, you finished document X and want to send it or print it the next day and then the PC makes trouble. So backups are very important for damage limitation. For this case i wrote a script(1)(2), which saves backups on an external disk. Because making Backups is can take much time there is rsync. Rsync saves only the files you have changed. Here the actually Version 2 of the script:
#!/bin/bash # sync home-dir with USB-disk # author maces # Version 2 # With this script you can sync you home-dir with a USB-disk # You should change the user name and the backup-dir # parameter "tousb" sync to disk # parameter "topc" sync to pc # test if USB-disk is mounted # Please change the path ("USB-HDD") if test -r /media/USB-HDD/ ; then # success message echo "SYNC-dir exists and is mounted" # else else # Error echo "USB-disk not mounted" echo "sync cannot be started" echo "abort process!" # end exit fi # test if $USER is the active user # this is useful if you want to sync YOUR home # and saved the script globally (/usr/bin/sync) if test $USER == "maces" ; then # success message echo "Right user is logged in" echo "Sync will be performed" # else else # error echo "wrong user is logged in" echo "sync cannot be started" echo "abort process!" # end exit fi # check parameters "topc" if test $1 == "topc" ; then # start sync # backup-dir on external disk # into home-dir echo "start sync" # Please change the path ("USB-HDD") rsync -a /media/USB-HDD /home/maces echo "synced successfully" exit fi # check parameters "tousb" if test $1 == "tousb"; then # start sync # home-dir into backup-dir # on external disk echo "start sync" # Please change the path ("USB-HDD") rsync -a /home/maces /media/USB-HDD echo "synced successfully" exit fi # other message echo "no parameters given" echo "use >> tousb << " echo "or use >> topc << " # end
You can find an alternative here (de).
2 Responses.
[...] Synchronisation [...]
[...] Synchronisation [...]