feat(cli): add -v debug flags to trace file writes and env path creations during deployment

This commit is contained in:
2026-03-24 17:16:58 +08:00
parent b1c7b9f8f7
commit 35bf24f0f3
3 changed files with 31 additions and 7 deletions

View File

@@ -3,11 +3,10 @@ package daemon
import (
"context"
"github.com/kardianos/service"
"smart-shutdown/pkg/config"
"smart-shutdown/pkg/logger"
"smart-shutdown/pkg/monitor"
"github.com/kardianos/service"
)
type program struct {
@@ -41,13 +40,17 @@ func (p *program) Stop(s service.Service) error {
return nil
}
func GetService(cfg *config.Config) (service.Service, error) {
func GetService(cfg *config.Config, execPath ...string) (service.Service, error) {
svcConfig := &service.Config{
Name: "SmartNetworkMonitor",
DisplayName: "Smart Network Shutdown Monitor",
Description: "A reliable daemon that periodically monitors network states and triggers node suspension logically.",
}
if len(execPath) > 0 && execPath[0] != "" {
svcConfig.Executable = execPath[0]
}
prg := &program{
cfg: cfg,
}