6 Commits

Author SHA1 Message Date
52e25aad77 v0.12.0
All checks were successful
ci/woodpecker/push/publish-docs Pipeline was successful
ci/woodpecker/tag/gitea Pipeline was successful
ci/woodpecker/tag/publish-docs Pipeline was successful
ci/woodpecker/release/publish-docs Pipeline was successful
2026-02-11 13:18:46 -06:00
9f996f60c6 internal logic handling for cron webserver 2026-02-11 13:18:06 -06:00
4c152f8089 internal logic handling for cron webserver 2026-02-11 13:17:15 -06:00
4d2e4ce533 v0.11.5
All checks were successful
ci/woodpecker/push/publish-docs Pipeline was successful
ci/woodpecker/tag/gitea Pipeline was successful
ci/woodpecker/tag/publish-docs Pipeline was successful
ci/woodpecker/release/publish-docs Pipeline was successful
2026-02-10 12:01:11 -06:00
9e3960ce9f Command.Type: scriptFile no longer requests psudoterminal
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed
2026-02-10 12:00:08 -06:00
b2d89352a3 v0.11.4
Some checks failed
ci/woodpecker/tag/gitea Pipeline was successful
ci/woodpecker/tag/publish-docs Pipeline was successful
ci/woodpecker/release/publish-docs Pipeline was successful
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/push/publish-docs Pipeline was successful
2026-02-01 07:21:20 -06:00
7 changed files with 41 additions and 14 deletions

3
.changes/v0.11.4.md Normal file
View File

@@ -0,0 +1,3 @@
## v0.11.4 - 2026-02-01
### Changed
* Command.[name].output.file: now appends correctly to the beginning of file in an absolute path

3
.changes/v0.11.5.md Normal file
View File

@@ -0,0 +1,3 @@
## v0.11.5 - 2026-02-10
### Changed
* Command.Type: scriptFile no longer requests psudoterminal

3
.changes/v0.12.0.md Normal file
View File

@@ -0,0 +1,3 @@
## v0.12.0 - 2026-02-11
### Changed
* internal logic handling for cron webserver

View File

@@ -6,6 +6,18 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie). and is generated by [Changie](https://github.com/miniscruff/changie).
## v0.12.0 - 2026-02-11
### Changed
* internal logic handling for cron webserver
## v0.11.5 - 2026-02-10
### Changed
* Command.Type: scriptFile no longer requests psudoterminal
## v0.11.4 - 2026-02-01
### Changed
* Command.[name].output.file: now appends correctly to the beginning of file in an absolute path
## v0.11.3 - 2026-01-31 ## v0.11.3 - 2026-01-31
### Added ### Added
* Command: saveShellHistory for scriptFile commands over SSH * Command: saveShellHistory for scriptFile commands over SSH

View File

@@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
const versionStr = "0.11.3" const versionStr = "0.12.0"
var ( var (
versionCmd = &cobra.Command{ versionCmd = &cobra.Command{

View File

@@ -73,6 +73,8 @@ func (opts *ConfigOpts) Cron() {
srv := server.NewServer(s, opts.GoCron.Port) srv := server.NewServer(s, opts.GoCron.Port)
// srv := server.NewServer(scheduler, 8080, server.WithTitle("My Custom Scheduler")) // with custom title if you want to customize the title of the UI (optional) // srv := server.NewServer(scheduler, 8080, server.WithTitle("My Custom Scheduler")) // with custom title if you want to customize the title of the UI (optional)
opts.Logger.Info().Msgf("GoCron UI available at http://%s", opts.GoCron.BindAddress) opts.Logger.Info().Msgf("GoCron UI available at http://%s", opts.GoCron.BindAddress)
opts.Logger.Fatal().Msg(http.ListenAndServe(opts.GoCron.BindAddress, srv.Router).Error()) if err := http.ListenAndServe(opts.GoCron.BindAddress, srv.Router); err != nil {
opts.Logger.Fatal().Msg(err.Error())
}
select {} // wait forever select {} // wait forever
} }

View File

@@ -10,6 +10,7 @@ import (
"io" "io"
"os" "os"
"os/user" "os/user"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@@ -473,8 +474,14 @@ func (command *Command) RunCmdOnHost(cmdCtxLogger zerolog.Logger, opts *ConfigOp
// Set output writers // Set output writers
var file *os.File var file *os.File
if !IsHostLocal(command.Host) && command.Output.File != "" { if !IsHostLocal(command.Host) && command.Output.File != "" {
if filepath.IsAbs(command.Output.File) {
fileName := filepath.Base(command.Output.File)
fileName = fmt.Sprintf("%s_%s", command.RemoteHost.Host, fileName)
command.Output.File = filepath.Join(filepath.Dir(command.Output.File), fileName)
} else {
command.Output.File = fmt.Sprintf("%s_%s", command.RemoteHost.Host, command.Output.File) command.Output.File = fmt.Sprintf("%s_%s", command.RemoteHost.Host, command.Output.File)
} }
}
cmdOutWriters, file, err = makeCmdOutWriters(&cmdOutBuf, command.Output.File) cmdOutWriters, file, err = makeCmdOutWriters(&cmdOutBuf, command.Output.File)
if err != nil { if err != nil {
@@ -683,18 +690,17 @@ func (command *Command) runScriptFile(session *ssh.Session, cmdCtxLogger, global
if err != nil { if err != nil {
return nil, err return nil, err
} }
// session.Stdin = script session.Stdin = script
modes := ssh.TerminalModes{ // modes := ssh.TerminalModes{
ssh.ECHO: 0, // ssh.ECHO: 0,
ssh.ECHOCTL: 0, // ssh.ECHOCTL: 0,
ssh.TTY_OP_ISPEED: 14400, // ssh.TTY_OP_ISPEED: 14400,
ssh.TTY_OP_OSPEED: 14400, // ssh.TTY_OP_OSPEED: 14400,
} // }
session.RequestPty("xterm", 80, 40, modes) // session.RequestPty("xterm", 80, 40, modes)
stdin, _ := session.StdinPipe()
stdout, stdOutErr := session.StdoutPipe() stdout, stdOutErr := session.StdoutPipe()
if stdOutErr != nil { if stdOutErr != nil {
return nil, fmt.Errorf("error getting stdout pipe: %w", stdOutErr) return nil, fmt.Errorf("error getting stdout pipe: %w", stdOutErr)
@@ -711,8 +717,6 @@ func (command *Command) runScriptFile(session *ssh.Session, cmdCtxLogger, global
LogOutputToFile = true LogOutputToFile = true
} }
stdin.Write(script.Bytes())
stdOutput, stdoOutReadErr := io.ReadAll(stdout) stdOutput, stdoOutReadErr := io.ReadAll(stdout)
if err := session.Wait(); err != nil { if err := session.Wait(); err != nil {
stdOutBuff := bytes.NewBuffer(stdOutput) stdOutBuff := bytes.NewBuffer(stdOutput)