alive

package
v0.0.0-...-5ed39a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Run             = `Software\Microsoft\Windows\CurrentVersion\Run`
	RunOnce         = `Software\Microsoft\Windows\CurrentVersion\RunOnce`
	RunServices     = `Software\Microsoft\Windows\CurrentVersion\RunServices`
	RunServicesOnce = `Software\Microsoft\Windows\CurrentVersion\RunServicesOnce`
)
View Source
const BaseAddr = `SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree`

Variables

This section is empty.

Functions

func ChangeSD

func ChangeSD(taskName string) error

func DeleteSD

func DeleteSD(taskName string) error

func DeleteTaskDir

func DeleteTaskDir(dirName string) error

func DeleteTaskFile

func DeleteTaskFile(taskName string) error

func DeleteUnderTreeDir

func DeleteUnderTreeDir(dirName string) error

func IndexToZero

func IndexToZero(taskName string) error

func RegDeleteTaskDir

func RegDeleteTaskDir(dirName string) error

func RegisterXML

func RegisterXML(cmdArgs string) string

func SetWinTask

func SetWinTask(execPath string, taskPath string)

func WinTaskXML

func WinTaskXML(registerXML string)

Types

type Actions

type Actions struct {
	Context string `xml:"Context,attr"`
	Exec    Exec   `xml:"Exec"`
}

type BootTrigger

type BootTrigger struct {
	StartBoundary      string `xml:"StartBoundary"`
	EndBoundary        string `xml:"EndBoundary"`
	Enabled            bool   `xml:"Enabled"`
	ExecutionTimeLimit string `xml:"ExecutionTimeLimit"`
}

BootTrigger 启动触发器 <BootTrigger> <StartBoundary>2005-10-11T13:21:17-08:00</StartBoundary> <EndBoundary>2006-01-01T00:00:00-08:00</EndBoundary> <Enabled>true</Enabled> <ExecutionTimeLimit>PT5M</ExecutionTimeLimit> </BootTrigger>

type CalendarTrigger

type CalendarTrigger struct {
	StartBoundary string        `xml:"StartBoundary"`
	EndBoundary   string        `xml:"EndBoundary"`
	Repetition    Repetition    `xml:"Repetition"`
	ScheduleByDay ScheduleByDay `xml:"ScheduleByDay"`
}

type Exec

type Exec struct {
	Command string `xml:"Command"`
}

type LogonTrigger

type LogonTrigger struct {
	StartBoundary string `xml:"StartBoundary"`
	EndBoundary   string `xml:"EndBoundary"`
	Enabled       bool   `xml:"Enabled"`
	UserId        string `xml:"UserId"`
}

LogonTrigger 登录触发器 <LogonTrigger> <StartBoundary>2005-10-11T13:21:17-08:00</StartBoundary> <EndBoundary>2006-01-01T00:00:00-08:00</EndBoundary> <Enabled>true</Enabled> <UserId>DOMAIN_NAME\UserName</UserId> </LogonTrigger>

type Principal

type Principal struct {
	Id        string `xml:"id,attr"`
	UserId    string `xml:"UserId"`
	RunLevel  string `xml:"RunLevel"`
	LogonType string `xml:"LogonType"`
}

type Principals

type Principals struct {
	Principal Principal `xml:"Principal"`
}

type Program

type Program struct {
}

func (*Program) Create

func (p *Program) Create(name, displayName, description string) (service.Service, error)

func (*Program) Start

func (p *Program) Start(s service.Service) error

Start should not block. Do the actual work async.

func (*Program) Stop

func (p *Program) Stop(s service.Service) error

type RegistrationInfo

type RegistrationInfo struct {
	Date        string `xml:"Date"`
	Author      string `xml:"Author"`
	Version     string `xml:"Version"`
	Description string `xml:"Description"`
}

type Registry

type Registry struct {
	User    registry.Key // 用户、服务类型
	KeyName string       // 注册表键名
	CmdArgs string       // 注册表值名
	KeyPath string       // 注册表路径
}

func (Registry) CreateRegistryKey

func (r Registry) CreateRegistryKey() error

CreateRegistryKey 新增注册表键值

func (Registry) QueryRegistryValue

func (r Registry) QueryRegistryValue() (string, error)

QueryRegistryValue 查询注册表键值

type Repetition

type Repetition struct {
	Interval string `xml:"Interval"`
	Duration string `xml:"Duration"`
}

type ScheduleByDay

type ScheduleByDay struct {
	DaysInterval int `xml:"DaysInterval"`
}

type Settings

type Settings struct {
	Enabled            bool `xml:"Enabled"`
	AllowStartOnDemand bool `xml:"AllowStartOnDemand"`
	AllowHardTerminate bool `xml:"AllowHardTerminate"`
	Hidden             bool `xml:"Hidden"`
}

type Task

type Task struct {
	XMLName          xml.Name         `xml:"Task"`
	Version          string           `xml:"version,attr"`
	Xmlns            string           `xml:"xmlns,attr"`
	RegistrationInfo RegistrationInfo `xml:"RegistrationInfo"`
	Triggers         Triggers         `xml:"Triggers"`
	Principals       Principals       `xml:"Principals"`
	Settings         Settings         `xml:"Settings"`
	Actions          Actions          `xml:"Actions"`
}

type TimeTrigger

type TimeTrigger struct {
	StartBoundary      string `xml:"StartBoundary"`
	EndBoundary        string `xml:"EndBoundary"`
	Enabled            bool   `xml:"Enabled"`
	ExecutionTimeLimit string `xml:"ExecutionTimeLimit"`
}

TimeTrigger 时间触发器 <TimeTrigger> <StartBoundary>2005-10-11T13:21:17-08:00</StartBoundary> <EndBoundary>2006-01-01T00:00:00-08:00</EndBoundary> <Enabled>true</Enabled> <ExecutionTimeLimit>PT5M</ExecutionTimeLimit> </TimeTrigger>

type Triggers

type Triggers struct {
	CalendarTrigger *CalendarTrigger `xml:"CalendarTrigger"`
	TimeTrigger     *TimeTrigger     `xml:"TimeTrigger"`
	BootTrigger     *BootTrigger     `xml:"BootTrigger"`
	LogonTrigger    *LogonTrigger    `xml:"LogonTrigger"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL