Приемы профессиональной работы в UNIX

         

КОМАНДНЫЙ ФАЙЛ autobkp


1 : 2 # @(#) autobkp v1.0 Automatic file backup Author: Russ Sage 4 if [ $# -gt 1 ] 5 then echo "autobkp: argument error" >&2 6 echo "usage: autobkp [-c] [>logfile]" >&2 7 exit 8 fi   10 if [ "$1" = "-c" ] 11 then COPY=on 12 else COPY=off 13 fi   15 echo "\nBACKUP DATE `date '+%a %m/%d/%y %H:%M:%S'`" 16 echo "-----------------------------------------"   18 SYSTEM='' # destination system uucp node name 19 : ${SYSTEM:=`uuname -l`}   21 echo "Sourse system:\t\t`uuname -l`\nDestination system:\t$SYSTEM"   23 while read SRCDIR DESTDIR FILES 24 do 25 if [ ! -d $SRCDIR ] 26 then echo "autobkp: $SRCDIR is not a directory" 27 continue 28 fi   30 cd $SRCDIR 31 echo "\nFinding files in: $SRCDIR"   33 for FILE in `find . -type f -ctime 0 -name "$FILES" -print` 34 do 35 case $COPY in 36 off) uucp $FILE $SYSTEM!$DESTDIR;; 37 on) cp $FILE $DESTDIR;; 38 esac 39 echo " Transferred $FILE to $DESTDIR" 40 done 41 done  



Содержание раздела