File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ func AddCommands(parent *cobra.Command) {
22
22
ch := notify .NewOfficialChanify (chanifyToken )
23
23
24
24
full := utils .Must1 (cmd .Flags ().GetBool (`full` ))
25
+ every := utils .Must1 (cmd .Flags ().GetDuration (`every` ))
25
26
26
27
cred := Credential {
27
28
Author : os .Getenv (`AUTHOR` ),
@@ -38,16 +39,19 @@ func AddCommands(parent *cobra.Command) {
38
39
if err := gs .Sync (); err != nil {
39
40
ch .Send ("同步失败" , err .Error (), true )
40
41
log .Println (err )
41
- time .Sleep (time .Minute * 15 )
42
42
continue
43
43
} else {
44
- log .Println (`同步完成。` )
45
44
ch .Send (`同步成功` , `全部完成,没有错误。` , false )
45
+ log .Println (`同步完成。` )
46
+ }
47
+ if every <= 0 {
48
+ break
46
49
}
47
- time .Sleep (time . Hour )
50
+ time .Sleep (every )
48
51
}
49
52
},
50
53
}
51
54
syncCmd .Flags ().Bool (`full` , false , `初次备份是否全量扫描更新。` )
55
+ syncCmd .Flags ().Duration (`every` , 0 , `每隔多久同步一次。如果不设置,默认只同步一次。` )
52
56
parent .AddCommand (syncCmd )
53
57
}
You can’t perform that action at this time.
0 commit comments