Commit Graph

220 Commits

Author SHA1 Message Date
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 abe98a9274 Provide custom log directory for posix (#311)
When running a service with posix, provide a custom path to the
service output
2022-04-28 07:56: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
tomfeigin ff1da96551 Run systemd commands with --user flag (#310)
When controlling a user service with systemd supply the --user flag
2022-04-27 07:10:17 -05:00
Ali Yousuf ed46af2312 Replace std out/err path to an existing directory (#307) 2022-04-27 07:08:57 -05:00
Marcel Gebhardt 5c08916379 fix: use /etc/rc.d/rc2.d instead of /etc/rc2.d depending on AIX version (#317)
Co-authored-by: Codehardt <marcel.gebhardt@bsk-consulting.de>
2022-01-26 09:11:01 -06:00
chbuescher 6fe2824ee8 aix issue 242: improved test, if process runs as child of srcmstr (#302)
Co-authored-by: xca1075 <Christoph.Buescher@atruvia.de>
2021-11-11 11:20:41 -06:00
Yujie.Zhao b9d1d5b727 fix: sysv linux not support ps $pid (#299) 2021-11-04 11:38:26 -05:00
Karen Almog a323c3813b fix for the openrc status func (#283)
* fix for the openrc status func

Signed-off-by: Karen Almog <kalmog@mirantis.com>

* openrc: exitCode parsing for better status

Signed-off-by: Karen Almog <kalmog@mirantis.com>
2021-07-27 19:15:19 -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
djdv 8eb6809ed2 Add documentation for platform options and expose to Godoc (#266) 2021-06-10 06:49:49 -05:00
Arran Walker 82b10ec284 service(darwin): fix status regression (#273)
Co-authored-by: Arran Walker <ajwalker@gitlab.com>
2021-06-10 06:42:10 -05:00
Tomasz Maczukin 3b7119afcd Fix interaction with systemd (#274)
The library is using inconsistent names when calling `systemctl`
commands.

Let's say that the service is named `name`. The unit file will be
then named `name.service` - this is the popular pattern used also by
this library.

While for most common commands like `systemctl start` there is no
difference whether `name` or `name.service` will be used as the service
identifier, the `list-unit-files` command expects explicitly the unit
file name.

Currently just the name - without the `.service` suffix - is being used,
which causes the command to return no output, not match the name of the
service and finally respond the status of installed but inactive service
as `StatusUnknown` with `ErrNotInstalled` error. While `StatusStopped`
without any error is expected.

Considering `systemctl` behavior it's just easier to:

- have one method that constructs the `name.service` name,
- use it for all `systemctl` commands calls.

And this is the change that this commit is adding.
2021-06-10 06:40:54 -05:00
Karen Almog ef35c56320 Add support for OpenRC services (alpine/busybox) (#252) 2020-12-11 08:35:37 -06:00
Daniel Theophanes 18c957a3dc service: go fmt 2020-11-17 11:30:05 -06: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
Oliver Kraemer 258d7b252b Run commands as user on systemd when using user service (#224) 2020-11-16 08:55:05 -06:00
Blake Rouse 60dcbae4c5 Fix issue with systemd inactive status. (#243) 2020-11-16 08:52:11 -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
pavelbazika 19f776cc5f Detection of interactive session fixed for systemd user services (#246)
Co-authored-by: Pavel Bazika <pavel.bazika@icewarp.com>
2020-11-16 08:45:35 -06:00
santosh653 5dd9ac4ef7 Update .travis.yml (#248)
Adding both Power & Intel support
arch: ppc64le/amd64
2020-11-16 08:44:20 -06:00
secDre4mer 7c688a995c chore: Add explicit AIX tag to AIX specific sources (#245)
Add an explicit AIX build restriction to the AIX specific source
files to allow Go versions <1.12 to compile the module.
2020-10-27 11:28:19 -05:00
Simon Backx a1c091bc7f Added LimitNOFILE option in systemd configuration (#94)
Co-authored-by: Daniel Theophanes <kardianos@gmail.com>
2020-06-07 11:51:47 -07:00
Jakob Borg f5ff0fc585 Clarify Interface.Start() documentation comment (#179) 2020-06-07 11:43:39 -07:00
Daniel Theophanes f6135ae0e8 service: do not run user service test by default (fails in CI) 2020-06-07 11:39:12 -07:00
Julius Berger ec63d01a8d support systemd user services (#185) 2020-06-07 11:34:08 -07:00
Olivier Poitrey 14b2cc59a2 Add FreeBSD support (#197)
* Add FreeBSD support

* freebsd: use service cmd instead of rc script directly
2020-06-07 11:28:44 -07:00
Gadzev 6fb11709cd Fixed typo in function documentation 2020-06-07 11:24:57 -07:00
SteelPhase 15406c80f4 Return a better status for "activating" 2020-06-07 11:14:48 -07:00
Daniel Theophanes 095e475882 service: on windows close service handle on status 2020-06-07 11:06:18 -07:00
Daniel Theophanes 5544762d3e service/example/runner: do not check ProcessState as it may be nil
Fixes #218
2020-06-07 11:01:04 -07:00
Daniel Theophanes 2ce04d92a6 service: requrie go1.12 due to aix 2020-06-07 10:46:29 -07:00
Anthony "Ishpeck" Tedjamulia 5ab104476c Fixing systemd complaint that service configurations are world-inaccessible after install 2020-06-07 10:36:36 -07:00
Dean(老路) 3c356ae54c Upstart supports the "restart" option (#193) 2019-12-10 19:17:25 -08:00
chbuescher 7c2e4f75a4 Initial support for aix and solaris (#194)
* initial support for aix and solaris

* support for aix & solaris - missing changes
2019-12-10 19:14:15 -08:00
ANDREY KHASANOV 6b582019e8 Redirect logs to std for mac (#196)
Add support for StandardOutPath and StandardErrorPath for darwin
2019-12-10 19:12:41 -08:00
Rustam 4df36c9fc1 Fix the inability to start with logger in docker contianer (#178)
* check for docker/lxc in isInteractive() for linux

* more clear logic and function name

* add some tests for linux part

* fix test

* cover coverage
2019-10-17 07:57:38 -07:00
Liam Haworth 28e7e9edbb bugfix(unix): Check for and ingore "Operating in progress" (#182)
Added some checking in the stderr reading of `run` in `service_unix` to
identify if the output ended with `Operation now in progress` is the
command was `launchctl`.

If the output has the suffix it is ignored and treated as a non-error,
all other standard error output is treaded as an error like normal.
2019-10-17 07:56:41 -07:00
Rozen Lin fffe6c52ed Support the systemd option setting for 'Restart' and 'SuccessExitStatus (#168)
* support the dependency config for linux systemd

* remote the binary file incorrectly added

* Support the systemd option setting for 'Restart' and 'SuccessExitStatus'
2019-05-14 08:51:56 -07:00
Peter Hommel 61d6d01901 Linux systemd: two small fixes (#171)
* Linux systemd: fixed bug in service configuration template. Dependencies should now work for Linux systemd.

* Linux systemd: enabled detection of systemd inside chroot environments

* Linux systemd: enabled detection of systemd inside chroot environments fix
2019-05-14 08:36:39 -07:00
RozenLin 0e5bec1b9e Systemd/dep (#165)
* support the dependency config for linux systemd

* remote the binary file incorrectly added
2019-03-26 09:10:25 -07:00
Daniel Theophanes 56787a3ea0 remove dep on osext 2019-02-08 09:29:24 -08:00
Harald Nordgren 4c239ee84e Bump Go versions (#153) 2018-11-14 16:55:16 -08: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
Daniel Theophanes 2b860c2dd7 Merge pull request #146 from osleg/fix/windows-reinstall
Fixes reinstall after uninstall with SC
2018-09-10 15:17:54 -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