Skip to content

Commit

Permalink
service(windows): add support for delayed auto start service (#244)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
utkarsh-extc and Utkarsh Dixit committed Nov 16, 2020
1 parent 19f776c commit a91b404
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -2,4 +2,4 @@ module github.com/kardianos/service

go 1.12

require golang.org/x/sys v0.0.0-20190204203706-41f3e6584952
require golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211
10 changes: 6 additions & 4 deletions service.go
Expand Up @@ -80,12 +80,12 @@ const (
optionPrefix = "Prefix"
optionPrefixDefault = "application"

optionRunWait = "RunWait"
optionReloadSignal = "ReloadSignal"
optionPIDFile = "PIDFile"
optionRunWait = "RunWait"
optionReloadSignal = "ReloadSignal"
optionPIDFile = "PIDFile"
optionLimitNOFILE = "LimitNOFILE"
optionLimitNOFILEDefault = -1 // -1 = don't set in configuration
optionRestart = "Restart"
optionRestart = "Restart"

optionSuccessExitStatus = "SuccessExitStatus"

Expand Down Expand Up @@ -151,6 +151,8 @@ type Config struct {
// in addition to the default ones.
// * Linux (systemd)
// - 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
}
Expand Down
1 change: 1 addition & 0 deletions service_windows.go
Expand Up @@ -214,6 +214,7 @@ func (ws *windowsService) Install() error {
ServiceStartName: ws.UserName,
Password: ws.Option.string("Password", ""),
Dependencies: ws.Dependencies,
DelayedAutoStart: ws.Option.bool("DelayedAutoStart", false),
}, ws.Arguments...)
if err != nil {
return err
Expand Down

0 comments on commit a91b404

Please sign in to comment.