Add 'restore_rocket_db.sh'
This commit is contained in:
parent
895a88ccff
commit
6ca8b332fd
16
restore_rocket_db.sh
Normal file
16
restore_rocket_db.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
now=$(date +%s)
|
||||||
|
target=$(date -d "23:30" +%s)
|
||||||
|
|
||||||
|
if [ $now -ge $target ]; then
|
||||||
|
rsync '-e ssh -p 9011' -avz cheeseplant@netcup:/home/cheeseplant/rocketchat/rocket_db.tar /home/franv/rocket_backup/.
|
||||||
|
docker cp rocket_backup/rocket_db.tar mongo:.
|
||||||
|
docker exec mongo mongorestore --archive=rocket_db.tar --db=rocketchat
|
||||||
|
|
||||||
|
sleep $[24*60*60] # wait for 24 hours before running again
|
||||||
|
else
|
||||||
|
sleep $[$target-$now] # wait until 22:00 before running
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
Reference in New Issue
Block a user