add: rm expired backup file and shell script
This commit is contained in:
@@ -5,7 +5,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"ems.agt/lib/dborm"
|
||||
"ems.agt/lib/global"
|
||||
"ems.agt/lib/log"
|
||||
"ems.agt/restagent/config"
|
||||
"ems.agt/src/framework/cron"
|
||||
)
|
||||
|
||||
@@ -71,7 +73,17 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
|
||||
// delete expired files in backup directory
|
||||
// todo ...
|
||||
// command := fmt.Sprintf("find . -name '*.zip' -mtime +%d -type f -print | xargs rm -rf", duration)
|
||||
|
||||
command := fmt.Sprintf("%s/rmexpfiles.sh %s %d", config.GetYamlConfig().OMC.BinDir, config.GetYamlConfig().OMC.Backup, duration)
|
||||
|
||||
log.Trace("command:", command)
|
||||
out, err := global.ExecCmd(command)
|
||||
if err != nil {
|
||||
log.Error("Faile to exec command:", err)
|
||||
return nil, err
|
||||
}
|
||||
log.Trace("command output:", out)
|
||||
// 返回结果,用于记录执行结果
|
||||
return map[string]any{
|
||||
"msg": "sucess",
|
||||
|
||||
Reference in New Issue
Block a user