-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
67 lines (45 loc) · 945 Bytes
/
update.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
#!/bin/sh
echo "Start update :"
br=" "
echo $br
echo "Dump remote db :"
echo $br
cmd1='cd www/lbc'
cmd2='mongodump --db lbc'
ssh [email protected] "$cmd1; $cmd2"
echo $br
echo "Upload remote dump :"
echo $br
scp -r [email protected]:www/lbc/dump dumps
echo $br
echo "Restore local db :"
echo $br
mongorestore --drop dumps/dump
echo $br
echo "Backup dump :"
echo $br
from="dumps/dump"
to="dumps/dump-$(date '+%Y-%m-%d-%H-%M-%S')"
echo "$from ==> $to"
mv $from $to
echo $br
echo "Launch a new crawl :"
echo $br
node crawler --execute-search 5228f3c51bb0bc2b7aea9549
echo $br
echo "Dump local db :"
echo $br
mongodump --db lbc
echo $br
echo "Send local db to remote :"
echo $br
scp -r dump [email protected]:www/lbc/
rm -rf dump
echo $br
echo "Restore remote db :"
echo $br
cmd1='cd www/lbc'
cmd2='mongorestore --drop dump'
ssh [email protected] "$cmd1; $cmd2"
echo $br
echo "done."