Commit Graph

55 Commits

Author SHA1 Message Date
Maycon Santos 6f65ca52db remove windows fix 2022-10-11 10:00:08 +02:00
Maycon Santos 20ab3c184e remove windows fix 2022-10-11 09:59:29 +02:00
Maycon Santos edc05e0623 Merge pull request #1 from kardianos/master
sync upstream
2022-10-11 09:56:51 +02:00
Marco Pfatschbacher 380dcf887e Replace deprecated IsAnInteractiveSession() call (#344)
Using the service manager from an remote ssh command promt fails
with
`The service process could not connect to the service controller`

Thanks to the detailed analysis from @kelseyma the fix was very straight
forward.
Using IsWindowsService() solved this problem for me.

The mentioned issue at https://github.com/golang/go/issues/44921
has also been fixed in the meantime, so there is no reason not to
use IsWindowsService() instead.

Fixes #300
2022-10-10 16:59:33 -05:00
Marco Pfatschbacher 6547573c4d Do not create windows services with an empty environment key (#343)
Doing so will create services that are broken and will fail
when started:
`Error 87: The parameter is incorrect`

This is a regression from https://github.com/kardianos/service/pull/312
2022-10-10 16:56:32 -05:00
Maycon Santos 56a6ec0818 only attempt to set environment if list is not empty 2022-09-01 18:17:12 +02:00
tomfeigin 29f8c79c51 Windows access service with minimal perms (#313)
When performing actions on a service in a windows host, use the minimal
required permissions to allow non admin users to control the service
2022-04-28 07:57:17 -05:00
tomfeigin bc65850ac5 Allow setting environment variables for services (#312)
Setting environment variables for services running with systemd, OSx or
windows
2022-04-27 07:11:36 -05:00
Daniel Theophanes 36c9bf8c36 fix windows build 2021-06-15 20:19:51 -05:00
Alex Collins 5f1fed4906 patch the error text to check a syscall number instead (#276) 2021-06-15 14:18:25 -05:00
Daniel Theophanes a8dda22bce fix windows build 2021-06-10 09:36:42 -05:00
Eugene 17a2c7bcb5 Adds service control options for Windows service. (#258)
- StartType               string ("automatic")  - start service. Constants: ServiceStartDisabled, ServiceStartManual, ServiceStartDisabled
- OnFailure               string ("noaction" )  - action to perform on service failure. Constants: OnFailureRestart, OnFailureReboot, OnFailureNoAction
- OnFailureDelayDuration  string ( "1s" )       - delay before restarting the service, time.Duration string.
- OnFailureResetPeriod    int ( 10 )            - reset period for errors, seconds.

Fixes kardianos/service#226
Fixes kardianos/service#207
Fixes kardianos/service#103

Co-authored-by: Eugene <jdevelop@users.noreply.github.com>
Co-authored-by: Daniel Theophanes <kardianos@gmail.com>
2021-06-10 07:11:16 -05:00
Aram c7e6b82e87 allow inteactive setting mode for windows (#253)
Co-authored-by: Aram <aram.petrosyan@unity3d.com>
Co-authored-by: Daniel Theophanes <kardianos@gmail.com>
2021-06-10 07:02:15 -05:00
jhvaras 41add7e3c9 Shutdowner interface and Windows trigger (#225)
* Shutdowner interface and Windows trigger

* Updating Shutdown doc

Stop won't be called when Shutdown is.

Co-authored-by: Juan Hernandez <jhernandez@newrelic.com>
2020-11-16 08:58:05 -06:00
Utkarsh Dixit a91b404a4f 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>
2020-11-16 08:47:17 -06:00
Daniel Theophanes 095e475882 service: on windows close service handle on status 2020-06-07 11:06:18 -07:00
SteelPhase b1866cf769 Add ability for service to report the system managing the service (#147)
* Add ability for service to report the system managing the service

* Clarify that the output of SystemName should return the same value as Platform in most cases

* Rename SystemName to Platform to match the rest of the package

* be a little more clear in the Platform comment
2018-09-10 15:42:44 -07:00
Alex Kir 73cafb2ed3 Fixes reinstall after uninstall with SC
Fix for https://github.com/kardianos/service/issues/125
2018-09-07 15:42:59 +08:00
SteelPhase 8f267d80f2 Potentially resolve issue with os signals (#144)
* change error format

* capture SIGTERM for upstart, ignore SIGKILL

* for windows only notify on SIGINT
2018-08-22 17:15:10 -07:00
SteelPhase 45244176fc Add support for retrieving service status (#143)
* update command execution to support returing error codes, and stdout

add function to service interface to support returning service status

clean up places where strings were being converted to strings

* Spelling fix

* Simply service Status method

Add stopped detection to launchd
Switch to case statements
Return ErrNotInstalled in situations where we should
2018-08-22 11:05:01 -07:00
Daniel Theophanes 5ab7ce2c8f service: fix misc typos. 2015-09-01 09:34:29 -07:00
Daniel Theophanes 1ab12303aa service: block on windows stop so restart is more robust.
Previous behavior simply signalled the service to stop.
The new behavior actually waits for the service to stop.
This makes the Restart method for windows to be more robust
when a service takes more time to clean up.
2015-06-05 09:22:14 -07:00
Daniel Theophanes b1deffcaba service: add comments to exported comments. 2015-05-01 13:53:55 -07:00
Daniel Theophanes b7229667de service: make System.String() consistent.
Fixes #15
2015-05-01 12:16:19 -07:00
Daniel Theophanes eb835b9b7e service: move to windows svc package at x/sys/windows. 2015-05-01 07:58:43 -07:00