Skip to content

Commit

Permalink
TRSS backup story (#345)
Browse files Browse the repository at this point in the history
-related: #180
Signed-off-by: OscarQQ <[email protected]>
  • Loading branch information
OscarQQ authored Mar 23, 2021
1 parent 6d7b5e1 commit 0af7ea4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
17 changes: 16 additions & 1 deletion TestResultSummaryService/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,19 @@ A build can have the following status in database:
- `Done` - The build and its child builds are processed and stored.

## Plugins
Plugins can be added. Please refer [Plugins ReadMe](./plugins/README.md) for implementation detail.
Plugins can be added. Please refer [Plugins ReadMe](./plugins/README.md) for implementation detail.

## Configure Crontab on server

- step 1: run command `env`, copy the field SHELL and PATH
- step 2: run command `crontab -e` to install a cron job, using SHELL and PATH value from step1

example cron job:
```
SHELL=/bin/bash
MAILTO=/home/oscar/log
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
0 8 * * 5 <path>/openjdk-test-tools/exportMongo.sh
```
This cron job will run exportMongo.sh once every week at Saturday 8am
- step 3: run command `sudo chmod u+x exportMongo.sh` to grant cron access to shell scipt
9 changes: 9 additions & 0 deletions exportMongo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# find dump gzip that are older than 90 days and delete
find /home/mongoBackup -mtime 90 -type f -name "dump*" -delete

# export the whole db to gzip
mongodump --gzip --archive=/home/mongoBackup/dump_`date "+%Y-%m-%d-%T"`.gz --db=exampleDb

#restore using command mongorestore --archive=<path to gzip> --db exampleDb --gzip

0 comments on commit 0af7ea4

Please sign in to comment.