service(windows): add support for delayed auto start service (#244)

* service(windows): added option flag for delayed automatic start

* service(windows): added option flag for delayed automatic start

Co-authored-by: Utkarsh Dixit <utkarsh.dixit@siemens.com>
This commit is contained in:
Utkarsh Dixit
2020-11-16 20:17:17 +05:30
committed by GitHub
parent 19f776cc5f
commit a91b404a4f
3 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -2,4 +2,4 @@ module github.com/kardianos/service
go 1.12 go 1.12
require golang.org/x/sys v0.0.0-20190204203706-41f3e6584952 require golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211
+2
View File
@@ -151,6 +151,8 @@ type Config struct {
// in addition to the default ones. // in addition to the default ones.
// * Linux (systemd) // * Linux (systemd)
// - LimitNOFILE int - Maximum open files (ulimit -n) (https://serverfault.com/questions/628610/increasing-nproc-for-processes-launched-by-systemd-on-centos-7) // - LimitNOFILE int - Maximum open files (ulimit -n) (https://serverfault.com/questions/628610/increasing-nproc-for-processes-launched-by-systemd-on-centos-7)
// * Windows
// - DelayedAutoStart bool (false) - after booting start this service after some delay
Option KeyValue Option KeyValue
} }
+1
View File
@@ -214,6 +214,7 @@ func (ws *windowsService) Install() error {
ServiceStartName: ws.UserName, ServiceStartName: ws.UserName,
Password: ws.Option.string("Password", ""), Password: ws.Option.string("Password", ""),
Dependencies: ws.Dependencies, Dependencies: ws.Dependencies,
DelayedAutoStart: ws.Option.bool("DelayedAutoStart", false),
}, ws.Arguments...) }, ws.Arguments...)
if err != nil { if err != nil {
return err return err