ferry/pkg/service/task.go

25 lines
434 B
Go
Raw Normal View History

2020-07-15 01:40:56 +08:00
package service
import (
"ferry/pkg/task"
"fmt"
"strings"
"github.com/spf13/viper"
)
/*
@Author : lanyulei
*/
func ExecTask(taskList []string) {
for _, taskName := range taskList {
filePath := fmt.Sprintf("%v/%v", viper.GetString("script.path"), taskName)
if strings.HasSuffix(filePath, ".py") {
task.Send("python", filePath)
} else if strings.HasSuffix(filePath, ".sh") {
task.Send("shell", filePath)
}
}
}