mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-23 09:19:24 +08:00
feat: Add python2 and python3 options to the cronjob interpreter (#10662)
This commit is contained in:
parent
e2efa20582
commit
72e6b9b188
2 changed files with 9 additions and 3 deletions
|
|
@ -156,9 +156,13 @@ func (u *CronjobService) handleShell(cronjob model.Cronjob, taskItem *task.Task)
|
|||
cronjob.Executor = "bash"
|
||||
}
|
||||
if cronjob.ScriptMode == "input" {
|
||||
fileItem := pathUtils.Join(global.Dir.DataDir, "task", "shell", cronjob.Name, cronjob.Name+".sh")
|
||||
suffix := ".sh"
|
||||
if strings.HasPrefix(cronjob.Executor, "python") {
|
||||
suffix = ".py"
|
||||
}
|
||||
fileItem := pathUtils.Join(global.Dir.DataDir, "task", "shell", cronjob.Name, cronjob.Name+suffix)
|
||||
_ = os.MkdirAll(pathUtils.Dir(fileItem), os.ModePerm)
|
||||
shellFile, err := os.OpenFile(fileItem, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, constant.FilePerm)
|
||||
shellFile, err := os.OpenFile(fileItem, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, constant.DirPerm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,8 +427,10 @@
|
|||
v-model="form.executor"
|
||||
>
|
||||
<el-option value="bash" label="bash" />
|
||||
<el-option value="python" label="python" />
|
||||
<el-option value="sh" label="sh" />
|
||||
<el-option value="python" label="python" />
|
||||
<el-option value="python2" label="python2" />
|
||||
<el-option value="python3" label="python3" />
|
||||
</el-select>
|
||||
<el-input
|
||||
clearable
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue