Backup script

Материал из Marchellys Wiki

Перейти к: навигация, поиск
#!/bin/sh
set -x
D="/mnt/usb";
cat filelist.txt | grep '^/' | while read F; do
   if [ ! -e $F ]; then
       echo skip $F 1>&2
       continue
   fi
   while echo "$F => $D$F"
       ! cp -u --parents "$F" $D
   do
       rm "$D/$F"
#        umount $D
#        eject $D
       echo put next drive, and press Enter
       read T < /dev/tty
   done
done

Thanks to ramok #linux@Rusnet