forked from Dabz/mongo-backup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
41 lines (35 loc) · 985 Bytes
/
main.go
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
/*
** main.go for main.go
**
** Made by gaspar_d
** Login gaspar_d <[email protected]>
**
** Started on Wed 23 Dec 10:25:07 2015 gaspar_d
** Last update Mon 7 Mar 16:54:09 2016 gaspar_d
*/
package main
import (
"fmt"
"github.com/allanhung/mongo-backup/mongobackup"
)
func main() {
option := mongobackup.ParseOptions()
env := mongobackup.BackupEnv{}
err := env.SetupBackupEnvironment(option)
if err != nil {
fmt.Printf("Can not setup program environment (%s)", err)
}
if env.Options.Operation == mongobackup.OpBackup {
env.PerformBackup()
} else if env.Options.Operation == mongobackup.OpRestore {
env.PerformRestore()
} else if env.Options.Operation == mongobackup.OpLogdump {
env.PerformRestore()
} else if env.Options.Operation == mongobackup.OpList {
env.List(env.Options.Tag)
} else if env.Options.Operation == mongobackup.OpDelete {
env.PerformDeletion()
} else if env.Options.Operation == mongobackup.OpUpload {
env.PerformUpload()
}
}