feat: update
This commit is contained in:
@@ -55,10 +55,16 @@ func Serve(cmd *cobra.Command, args []string) error {
|
|||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
return errors.New("usage: compress path")
|
return errors.New("usage: compress path")
|
||||||
}
|
}
|
||||||
|
log.Infof("start compressing %s", args[0])
|
||||||
|
|
||||||
|
if err := commandCompress(args[0]); err != nil {
|
||||||
|
log.WithError(err).Errorf("compressing %s failed", args[0])
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
ticker := time.NewTicker(5 * time.Minute)
|
ticker := time.NewTicker(5 * time.Minute)
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
log.Infof("compressing %s", args[0])
|
log.Infof("start compressing %s", args[0])
|
||||||
|
|
||||||
if err := commandCompress(args[0]); err != nil {
|
if err := commandCompress(args[0]); err != nil {
|
||||||
log.WithError(err).Errorf("compressing %s failed", args[0])
|
log.WithError(err).Errorf("compressing %s failed", args[0])
|
||||||
@@ -93,6 +99,8 @@ func commandCompress(dir string) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Infof("process file %s", file.Name())
|
||||||
|
|
||||||
// get the file name
|
// get the file name
|
||||||
fileName := file.Name()
|
fileName := file.Name()
|
||||||
filePath := filepath.Join(dir, fileName)
|
filePath := filepath.Join(dir, fileName)
|
||||||
|
|||||||
Reference in New Issue
Block a user