-
Notifications
You must be signed in to change notification settings - Fork 0
/
backupa.sh
executable file
·108 lines (84 loc) · 2.06 KB
/
backupa.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
# backupscript
BASEURL="/mnt/alias/backup"
MAILURL="/mnt/alias/storage/shishaMail"
CLOUDURL="/mnt/alias/storage/owncloud"
MYDUMPURL="/mnt/alias/backup/mydump"
GITLABURL="/mnt/alias/backup/gitlab"
NODEBBURL="/mnt/alias/backup/nodebb"
DAY=`eval date +"%d"`
MONTH=`eval date +"%m"`
YEAR=`eval date +"%Y"`
HOUR=`eval date +"%H"`
MINUTE=`eval date +"%M"`
PIMPURL=$BASEURL/$YEAR/$MONTH/$DAY/
COMMAND="cd $PIMPURL"
$COMMAND 2>/dev/null
if [ $? -eq 0 ]
then
echo "Command 1 was successful"
else
echo "There ain't folders!!"
echo "I'll mkdir some!"
COMMAND="mkdir -p $PIMPURL"
$COMMAND 2>/dev/null
fi
if [ $? -eq 0 ]
then
echo 'Command 2 was successful'
echo "STARTING MAIL BACKUP"
COMMAND="tar cfvz ${PIMPURL}shisha_${HOUR}_${MINUTE}_.data.tar.gz ${MAILURL}"
$COMMAND 2>/dev/null
if [ $? -eq 0 ]
then
echo 'MAIL BACKUP SUCCESSFULL'
else
echo "FAILURE!!"
fi
HOUR=`eval date +"%H"`
MINUTE=`eval date +"%M"`
echo "STARTING CLOUD BACKUP"
COMMAND="tar cfvz ${PIMPURL}cloud_${HOUR}_${MINUTE}_.data.tar.gz ${CLOUDURL}"
$COMMAND 2>/dev/null
if [ $? -eq 0 ]
then
echo 'CLOUD BACKUP SUCCESSFULL'
else
echo "FAILURE!!"
fi
HOUR=`eval date +"%H"`
MINUTE=`eval date +"%M"`
echo "STARTING CLOUD BACKUP"
COMMAND="tar cfvz ${PIMPURL}mydump_${HOUR}_${MINUTE}_.data.tar.gz ${MYDUMPURL}"
$COMMAND 2>/dev/null
if [ $? -eq 0 ]
then
echo 'MYSQL BACKUP SUCCESSFULL'
else
echo "FAILURE!!"
fi
HOUR=`eval date +"%H"`
MINUTE=`eval date +"%M"`
echo "STARTING GITLAB BACKUP"
COMMAND="tar cfvz ${PIMPURL}gitlab_${HOUR}_${MINUTE}_.data.tar.gz ${GITLABURL}"
$COMMAND 2>/dev/null
if [ $? -eq 0 ]
then
echo 'MYSQL GITLAB SUCCESSFULL'
else
echo "FAILURE!!"
fi
HOUR=`eval date +"%H"`
MINUTE=`eval date +"%M"`
echo "STARTING NODEBB BACKUP"
COMMAND="tar cfvz ${PIMPURL}nodebb_${HOUR}_${MINUTE}_.data.tar.gz ${NODEBBURL}"
$COMMAND 2>/dev/null
if [ $? -eq 0 ]
then
echo 'NODEBB BACKUP SUCCESSFULL'
else
echo "FAILURE!!"
fi
else
echo 'Nope! Must be some kind of strage Err0r!!'
fi