specific app
This commit is contained in:
parent
26e4b56507
commit
29d37e0dc1
2
app.go
2
app.go
@ -586,7 +586,7 @@ func (a AppConfig) SendSnapshots() error {
|
||||
|
||||
func (a AppConfig) CleanupSnapshot() error {
|
||||
if *debugFlag {
|
||||
log.Printf("AppConfig.CleanupSnapshot : %s : Start]", a.Name)
|
||||
log.Printf("AppConfig.CleanupSnapshot : %s : Start", a.Name)
|
||||
}
|
||||
|
||||
cleanupSnapshot := make(map[string]string)
|
||||
|
41
backup.go
41
backup.go
@ -28,6 +28,7 @@ type BoxConfig struct {
|
||||
}
|
||||
|
||||
var (
|
||||
appFlag = flag.String("app", "", "run specific app")
|
||||
cfgFile = flag.String("config", "config.json", "config file")
|
||||
schedFlag = flag.String("schedule", "", "specific schedule")
|
||||
testFlag = flag.Bool("test", false, "test run")
|
||||
@ -203,7 +204,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = RunBackup()
|
||||
err = RunBackup(*appFlag)
|
||||
if err != nil {
|
||||
log.Printf("Cannot run schedule (%s)", err)
|
||||
os.Exit(1)
|
||||
@ -211,18 +212,34 @@ func main() {
|
||||
}
|
||||
|
||||
//RunBackup run all backup targets where schedule is registered
|
||||
func RunBackup() error {
|
||||
if *debugFlag {
|
||||
log.Printf("RunBackup() : Start")
|
||||
}
|
||||
|
||||
for _, app := range cfg.Apps {
|
||||
err := app.RunAppBackup()
|
||||
if err != nil {
|
||||
if *debugFlag {
|
||||
log.Printf("RunBackup() : Error running %s", app.Name)
|
||||
func RunBackup(app string) error {
|
||||
if app == "" {
|
||||
if *debugFlag {
|
||||
log.Printf("RunBackup() : Start")
|
||||
}
|
||||
for _, a := range cfg.Apps {
|
||||
err := a.RunAppBackup()
|
||||
if err != nil {
|
||||
if *debugFlag {
|
||||
log.Printf("RunBackup() : Error running %s", a.Name)
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if *debugFlag {
|
||||
log.Printf("RunBackup() : Start %s", app)
|
||||
}
|
||||
for _, a := range cfg.Apps {
|
||||
if a.Name == app {
|
||||
err := a.RunAppBackup()
|
||||
if err != nil {
|
||||
if *debugFlag {
|
||||
log.Printf("RunBackup() : Error running %s", a.Name)
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user