Files
go-worm/lib/startup/trcmdline.go
T
kato 977da8b109 feat(watchdog): separate watchdog from startup
- Add /api/v1/watchdog to enable/disable
- Scheduled task now runs every 15 minutes
- Use schtasks command line instead of XML
- Dashboard shows watchdog enabled state
- Preserve watchdog state during install
2026-09-02 00:15:37 +03:00

24 lines
554 B
Go

package startup
import (
"fmt"
"strings"
)
const ensureArg = "-ensure"
// ensureTaskTR is the schtasks /TR task action: "<exe> -ensure".
func ensureTaskTR(exe string) string {
return strings.Trim(exe, `"`) + " " + ensureArg
}
// schtasksCreateCmdLine is the full Windows command line for schtasks /Create.
// ponytail: SysProcAttr.CmdLine bypasses Go's /TR quoting bugs.
func schtasksCreateCmdLine(taskName, tr string) string {
return fmt.Sprintf(
`schtasks.exe /Create /TN %s /SC MINUTE /MO 15 /RL LIMITED /F /TR "%s"`,
taskName,
tr,
)
}