summaryrefslogtreecommitdiff
blob: 5db9df45c63c23643ed07b1e56d1913077ae3e7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

LOGFILE=/root/.log/cronlog
ERRFILE=/root/.log/errlog
BASEDIR=/root/opt/backup/html/
STBLDIR=/home/wrobel/opt/Stable/Www
USR=wrobel:users

rm $LOGFILE
rm $ERRFILE

date >> $LOGFILE
date >> $ERRFILE

for dir in `cat /var/www/data-backup`
  do
  mkdir -p $STBLDIR/$dir
  rsync -rptgo --delete-after  --exclude ".svn/" $dir/ $STBLDIR/$dir/ 2>> $ERRFILE | grep -v "skipping"
done
chown -R $USR $STBLDIR 

for dir in `cat /var/www/conf-backup`
  do
  mkdir -p $BASEDIR/$dir
  rsync -rptgo --delete-after  --exclude ".svn/" $dir/ $BASEDIR/$dir/ 2>> $ERRFILE | grep -v "skipping"
done

cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done
cd $BASEDIR && svn-del do &> $LOGFILE
cd $BASEDIR && svn-add do &> $LOGFILE

MESSAGE="$1"
[ ! "$MESSAGE" ] && MESSAGE="Automatic Update"
cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE"  >> $LOGFILE 2>> $ERRFILE 

cat $LOGFILE
cat $ERRFILE