Add 'backup_rocketchat.sh'
This commit is contained in:
parent
4bbf92b53b
commit
f8bd377edb
17
backup_rocketchat.sh
Normal file
17
backup_rocketchat.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
##### Run on source computer
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
now=$(date +%s)
|
||||||
|
target=$(date -d "23:00" +%s)
|
||||||
|
|
||||||
|
if [ $now -ge $target ]; then
|
||||||
|
/usr/bin/docker exec rocketchat_mongo_1 mongodump --archive=rocket_db.tar --db=rocketchat
|
||||||
|
/usr/bin/docker cp rocketchat_mongo_1:/rocket_db.tar /home/cheeseplant/rocketchat/.
|
||||||
|
|
||||||
|
|
||||||
|
sleep $[24*60*60] # wait for 24 hours before running again
|
||||||
|
else
|
||||||
|
sleep $[$target-$now] # wait until 23:00 before running
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
Reference in New Issue
Block a user