-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautorun-back3.sh
54 lines (36 loc) · 1.12 KB
/
autorun-back3.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/bash
BASE=/opt/projects/cpantesters
LOCK=$BASE/cpanstats-back3.lock
LOG=$BASE/cron/autorun-back3.log
date_format="%Y/%m/%d %H:%M:%S"
cd $BASE
if [ -f $LOCK ]
then
echo `date +"$date_format"` "Backup 3 already running" >>$LOG
else
touch $LOCK
echo `date +"$date_format"` "START" >>$LOG
cd $BASE/release
mkdir -p logs
mkdir -p data
echo `date +"$date_format"` "Archiving Release data..." >>$LOG
perl bin/release.pl --config=data/release.ini
echo `date +"$date_format"` "Compressing Release data..." >>$LOG
DB=$BASE/release/data/release.db
if [ -f $DB ]
then
cd $BASE/db
cp $DB .
cd $BASE/dbx
rm -f release.*
echo `date +"$date_format"` ".. compressing with gzip" >>$LOG
cp $DB . ; gzip release.db
echo `date +"$date_format"` ".. compressing with bzip" >>$LOG
cp $DB . ; bzip2 release.db
echo `date +"$date_format"` ".. compressed" >>$LOG
mkdir -p /var/www/cpandevel/release
mv release.* /var/www/cpandevel/release
fi
echo `date +"$date_format"` "STOP" >>$LOG
rm $LOCK
fi