-
Notifications
You must be signed in to change notification settings - Fork 0
/
autorun-back2.sh
45 lines (30 loc) · 1020 Bytes
/
autorun-back2.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
#!/usr/bin/bash
BASE=/opt/projects/cpantesters
LOCK=$BASE/cpanstats-back2.lock
LOG=$BASE/cron/autorun-back2.log
date_format="%Y/%m/%d %H:%M:%S"
cd $BASE
if [ -f $LOCK ]
then
echo `date +"$date_format"` "Backup 2 already running" >>$LOG
else
touch $LOCK
echo `date +"$date_format"` "START" >>$LOG
echo `date +"$date_format"` "Backing up Uploads data..." >>$LOG
cd $BASE/uploads
mkdir -p logs
mkdir -p data
perl bin/uploads.pl --config=data/uploads.ini -b >>$LOG 2>&1
echo `date +"$date_format"` "Compressing Uploads data..." >>$LOG
cd $BASE/dbx
rm -f uploads.*
cp $BASE/uploads/data/uploads.db . ; gzip uploads.db
cp $BASE/uploads/data/uploads.db . ; bzip2 uploads.db
mkdir -p /var/www/cpandevel/uploads
mv uploads.* /var/www/cpandevel/uploads
echo `date +"$date_format"` "Checking Uploads data..." >>$LOG
cd $BASE/uploads-mailer
perl bin/uploads-mailer.pl >>$LOG 2>&1
echo `date +"$date_format"` "STOP" >>$LOG
rm $LOCK
fi