Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ linters:
# Disable analyzers by name.
# Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers.
# Default: []
disable:
- fieldalignment # too strict
# Settings per analyzer.
settings:
shadow:
Expand Down
2 changes: 1 addition & 1 deletion cmd/meeseeks/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
)

type cmd struct {
logger *logger.Logger
configPath string
pidFile string
socketPath string
logger *logger.Logger
detach bool
}

Expand Down
6 changes: 3 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ type Config struct {
type ProgramConfig struct {
Name string `yaml:"name" json:"name"`
Command string `yaml:"command" json:"command"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Env []string `yaml:"env,omitempty" json:"env,omitempty"`
Interval string `yaml:"interval,omitempty" json:"interval,omitempty"`
KeepStdinOpen bool `yaml:"keep_stdin_open,omitempty" json:"keep_stdin_open,omitempty"`
Stdout string `yaml:"stdout,omitempty" json:"stdout,omitempty"`
Stderr string `yaml:"stderr,omitempty" json:"stderr,omitempty"`
BufferSizeLimit string `yaml:"buffer_size_limit,omitempty" json:"buffer_size_limit,omitempty"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Env []string `yaml:"env,omitempty" json:"env,omitempty"`
KeepStdinOpen bool `yaml:"keep_stdin_open,omitempty" json:"keep_stdin_open,omitempty"`
}

func (pc *ProgramConfig) GetInterval() (time.Duration, error) {
Expand Down
11 changes: 2 additions & 9 deletions internal/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,10 @@ type ServiceConfig struct {

// ServiceStatus represents the current state of a login service.
type ServiceStatus struct {
// Enabled indicates if the service is configured to start at login
LastRun time.Time
Error string
Enabled bool

// Running indicates if the service is currently running
Running bool

// LastRun is the timestamp of the last time the service was started
LastRun time.Time

// Error contains any error message if the service is in an error state
Error string
}

// GetService returns the appropriate Service implementation
Expand Down
2 changes: 1 addition & 1 deletion internal/server/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
)

type Client struct {
sockPath string
client *http.Client
sockPath string
}

func NewClient(ctx context.Context, sockPath string) *Client {
Expand Down
6 changes: 3 additions & 3 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ import (
type Server struct {
meeseeks meeseeks.Meeseek
server *http.Server
logger *logger.Logger
sockPath string
configPath string
timeout time.Duration
mu sync.RWMutex
running bool
logger *logger.Logger
timeout time.Duration
}

type Response struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Success bool `json:"success"`
}

func New(sockPath string, configPath string, logger *logger.Logger, timeout time.Duration) (*Server, error) {
Expand Down
14 changes: 7 additions & 7 deletions pkg/meeseeks/meeseek.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,30 +114,30 @@ type Meeseek interface {
type Statistics struct {
ProgramName string `json:"program_name"`
State string `json:"state"`
Successful int `json:"successful_runs"`
Failed int `json:"failed_runs"`
Output string `json:"output"`
Error string `json:"error"`
Interval string `json:"interval,omitempty"`
LastRunAt string `json:"last_run_at"`
NextRunAt string `json:"next_run,omitempty"`
Successful int `json:"successful_runs"`
Failed int `json:"failed_runs"`
}

type executionTrack struct {
lastRunAt time.Time
successful int
failed int
lastRunAt time.Time
}

type meeseek struct {
startTime time.Time
endTime time.Time
programs map[string]Program // Unified storage for all programs
schedulerStops map[string]chan struct{} // Only for scheduled programs
executions map[string]*executionTrack // execution tracking for each program
logger logger.Logger
programs map[string]Program
schedulerStops map[string]chan struct{}
executions map[string]*executionTrack
wg *sync.WaitGroup
mu sync.RWMutex
logger logger.Logger
}

func (m *meeseek) AddProgram(prog Program) error {
Expand Down
49 changes: 22 additions & 27 deletions pkg/program/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,34 +170,29 @@ func BufferSizeLimit(limit int) Option {
}

type program struct {
cmd *exec.Cmd
name string
command string
arguments []string
async bool
done chan struct{}

customStdout io.Writer
customStderr io.Writer
customStdin io.Reader
stdoutFile string
stderrFile string

keepStdinOpen bool
customStderr io.Writer
logger logger.Logger
customStdin io.Reader
customStdout io.Writer
pipes *pipes
cmd *exec.Cmd
done chan struct{}
stderrFile string
stdoutFile string
name string
command string
errorBuffer strings.Builder
outputBuffer strings.Builder
arguments []string
finalizers []func() error
customEnv []string

state ProcessState
exitCode int
outputBuffer strings.Builder
errorBuffer strings.Builder
bufferLimit int

dataLock sync.RWMutex
cmdLock sync.Mutex

pipes *pipes
logger logger.Logger
finalizers []func() error
bufferLimit int
exitCode int
state ProcessState
dataLock sync.RWMutex
cmdLock sync.Mutex
async bool
keepStdinOpen bool
}

type pipes struct {
Expand Down