diff --git a/internal/data/cron.go b/internal/data/cron.go index 33d21041..a346a29f 100644 --- a/internal/data/cron.go +++ b/internal/data/cron.go @@ -92,6 +92,9 @@ panel-cli cutoff website -n %s -p %s panel-cli cutoff clear -t website -f %s -s %d -p %s `, req.Target, req.BackupPath, req.Target, req.Save, req.BackupPath) } + if req.Type == "shell" { + script = req.Script + } shellDir := fmt.Sprintf("%s/server/cron/", app.Root) shellLogDir := fmt.Sprintf("%s/server/cron/logs/", app.Root) @@ -200,24 +203,6 @@ func (r *cronRepo) Status(id uint, status bool) error { return app.Orm.Save(cron).Error } -func (r *cronRepo) Log(id uint) (string, error) { - cron, err := r.Get(id) - if err != nil { - return "", err - } - - if !io.Exists(cron.Log) { - return "", errors.New("日志文件不存在") - } - - log, err := shell.Execf("tail -n 1000 '%s'", cron.Log) - if err != nil { - return "", err - } - - return log, nil -} - // addToSystem 添加到系统 func (r *cronRepo) addToSystem(cron *biz.Cron) error { if _, err := shell.Execf(`( crontab -l; echo "%s %s >> %s 2>&1" ) | sort - | uniq - | crontab -`, cron.Time, cron.Shell, cron.Log); err != nil {