@@ -206,36 +206,26 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
206206 fi
207207
208208 # Define exclude arguments
209+ exlusion=$( echo -e " $WEB " | tr ' ,' ' \n' | grep " ^$domain :" )
209210 set -f
210211 fargs=()
211- fargs+=(-not)
212- fargs+=(-path)
213- fargs+=(" ./logs*" )
214- exlusion=$( echo -e " $WEB " | tr ' ,' ' \n' | grep " ^$domain :" )
212+ fargs+=(--exclude=' logs/*' )
215213 if [ ! -z " $exlusion " ]; then
216214 xdirs=" $( echo -e " $exlusion " | tr ' :' ' \n' | grep -v $domain ) "
217215 for xpath in $xdirs ; do
218- xpath=" $( echo $xpath | sed -e ' s/\/*$//' -e ' s/^\/*//' ) "
219- fargs+=(-not)
220- fargs+=(-path)
221- fargs+=(" ./$xpath /*" )
216+ fargs+=(--exclude=$xpath /* )
222217 echo " $( date " +%F %T" ) excluding directory $xpath "
223218 msg=" $msg \n$( date " +%F %T" ) excluding directory $xpath "
224219 done
225220 fi
221+ set +f
226222
227223 # Backup files
228224 cd $HOMEDIR /$user /web/$domain
229- find . ${fargs[@]} -type f -or -type l -print0 | \
230- tar -cpf $tmpdir /web/$domain /domain_data.tar --null -T -
231-
232- # Backup empty folders
233- find . ${fargs[@]} -type d -empty -print0 | \
234- tar -rpf $tmpdir /web/$domain /domain_data.tar --null -T -
225+ tar -cpf $tmpdir /web/$domain /domain_data.tar * ${fargs[@]}
235226
236227 # Compress archive
237228 gzip -$BACKUP_GZIP $tmpdir /web/$domain /domain_data.tar
238- set +f
239229 done
240230
241231 # Print total
@@ -488,6 +478,7 @@ if [ "$USER" != '*' ]; then
488478 IFS=$' \n '
489479 set -f
490480 i=0
481+
491482 for udir in $( ls -a | egrep -v " conf|web|dns|mail|^\.\.$|^\.$" ) ; do
492483 exclusion=$( echo " $USER " | tr ' ,' ' \n' | grep " ^$udir $" )
493484 if [ -z " $exclusion " ]; then
@@ -496,13 +487,8 @@ if [ "$USER" != '*' ]; then
496487 echo -e " $( date " +%F %T" ) adding $udir "
497488 msg=" $msg \n$( date " +%F %T" ) adding $udir "
498489
499- # Backup files
500- find ./$udir ${fargs[@]} -type f -or -type l -print0 | \
501- tar -cpf $tmpdir /user_dir/$udir .tar --null -T -
502-
503- # Backup empty folders
504- find ./$udir ${fargs[@]} -type d -empty -print0 | \
505- tar -rpf $tmpdir /user_dir/$udir .tar --null -T -
490+ # Backup files and dirs
491+ tar -cpf $tmpdir /user_dir/$udir .tar $udir
506492
507493 # Compress arhive
508494 gzip -$BACKUP_GZIP $tmpdir /user_dir/$udir .tar
0 commit comments