25 lines
434 B
Go
25 lines
434 B
Go
![]() |
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)
|
||
|
}
|
||
|
}
|
||
|
}
|