Skip to main content

1E 8.1 (on-premises)

OperatingSystem.ControlService

Module

OperatingSystem

Method

ControlService

Library

Core

Action

Action to start, stop, etc. a service or daemon.

Parameters

Service (string): The service or daemon name. See Notes below.

Action (string; optional, default empty): One (or none) of "start", "stop", "restart", "pause" or "resume". Case is not significant. At least one of Action and/or Startup must be specified. "pause" and "resume" are only supported for Windows.

Startup (string; optional, default empty): If a non-empty string, the service startup type, one of "automatic", "delayed", "disabled" or "manual". Case is not significant. At least one of Action and/or Startup must be specified. Only used on Windows.

IncludeDependents (boolean; optional, default false): If specified and true and the action failed because of dependencies, perform the same action on the services that depend on this service then try the service action again. Only used on Windows.

StopDependencies (boolean; optional, default false): Previous name for IncludeDependents. Deprecated - use IncludeDependents.

Note

If the Action is "restart", the dependent services are always restarted automatically regardless of IncludeDependents / StopDependencies.

Return values

Action (string): A list of the action(s) successfully performed, with an empty value indicating that the action failed.

Example

OperatingSystem.ControlService(Service:"MisbehaveSvc", Startup:"Disabled");

For backwards compatibility this example use the deprecated "StopDependencies" name rather than "IncludeDependents":

OperatingSystem.ControlService(Service:"MisbehaveSvc", Action:"Stop", StopDependencies:true);

Platforms

  • Windows

  • Linux

  • MacOS

Notes

This cannot be used to stop, pause or disable the Tachyon and 1E Client services/daemons but start, restart and resume operations are allowed.

For Windows, the Service parameter is the service's name, not the service's display name. For example, to stop the 'Background Intelligent Transfer Service' service, supply 'BITS'.

For Linux systems that use systemd to control daemons, the Service parameter should be the name as known to systemd, e.g. "cups.service". For older Linuxes that still use /etc/init.d, the Service parameter should be the name of a script in the /etc/init.d directory, e.g. "cups".

For Mac, the Service parameter is the full path of the daemon's plist file, e.g. "/Library/LaunchDaemons/com.1E.Daemon.plist". Beware, because as Apple documentation states:

"Due to bugs in the previous implementation [of launchd and the launchctl command] and long-standing client expectations, ... zero is always returned."

So the method will always appear to succeed on the Mac even if the specified service does not exist or some other error occurs.

Warning

Setting Startup parameter to 'Manual' for Tachyon and 1E Client services is allowed, but the user needs to exercise caution using this functionality as it can lead to problems with the services not starting up correctly.