Operating System Service Mode

Iotellect Server may be started in operating system service mode. A service runs independently of logged-on users and can be run even if no user is logged on. A service cannot rely on the presence of a console, nor can it open windows. Service mode behavior depends on the operating system.

Iotellect Server service is registered by the installer. It is configured for auto-launch during operating system startup.

Service mode implementation is OS-specific:

  • For Microsoft Windows, service mode is represented by a Windows service

  • For Linux, service mode is represented by a daemon process

Microsoft Windows

When the service is installed, it can be controlled through Start > Control Panel > Administration > Services.

Installing and Uninstalling the Service

You can also install the service from the command line by passing /install to the service executable (iotellect_service.exe). To prevent the automatic startup of your service when the computer is booted, pass the argument /install-demand instead.

As a second parameter after the /install parameter, you can optionally pass a service name. In that way, you can install a service with a different service name than the default name.

Service is uninstalled by passing /uninstall to the service executable.

All command line switches also work with a prefixed dash instead of a slash (i.e, -uninstall) or two prefixed dashes (i.e, --uninstall).

Starting and Stopping the Service from Command Line

To start or stop the service, the /start and /stop options are available. In addition, the /status argument shows if the service is already running. The exit code of the status command is 0 when the service is running, 3 when it is not running, and 1 when the state cannot be determined (for example, when the service is not installed on Windows).

Service Auto-Restart

Windows service will be auto-restarted if exits with a non-zero exit code or crashes. This effectively means the service will be always available until it's explicitly stopped via any Iotellect Server user interface or Windows service control panel.

Linux/Unix

Different versions of Linux use different approaches for auto-starting and auto-respawning services (daemons), so Iotellect Server installer does its best to configure any auto-start and auto-restart behavior by default. Here is how it's technically organized:

Iotellect Server Linux installation contains several scripts that can be used to auto-start and auto-restart the server:

  • iot_server script starts the server and waits until it stops. It returns the Iotellect Server exit code, which is 0 if server shutdown was requested and 1 if server restart was requested. Other non-zero codes may be returned if the server has stopped due to a fatal error.

  • iotellect_service script starts the server as a daemon. The script accepts start, stop, restart or status arguments used to start/stop/restart the server or report its status respectively.

Auto-Start and Auto-Respawn for Systems with Upstart Init Daemon

To make the server auto-start and auto-respawn on systems that use Upstart init daemon, Iotellect Server installer copies iotellect.conf configuration file to /etc/init directory.

To start the server first time, run initctl start iot_server command.

Auto-Start and Auto-Respawn for Systems with Systemd Init Daemon

To make the server auto-start and auto-respawn on systems that use systemd init daemon, Iotellect Server installer copies iotellect.service configuration file to etcsystemdsystem directory.

To enable automatic start and respawn of the service, run systemctl enable iotellect.service command.

To start the server the first time, run systemctl restart iotellect.service command.

Note that automatic systemd-based service startup and respawn is not activated by Iotellect Server installer. You can reload systemctl daemon with command systemctl daemon-reload

To check service operation, run systemctl status iotellect_service.service -l command.

Auto-Start Without Auto-Respawn

In some very rare cases, it may be necessary to make Iotellect Server auto-start on OS startup but don't restart if its restart is requested via the server user interface.

To make Iotellect Server daemon auto-start upon OS startup but not restart even if its restart was requested via a UI, use iotellect_service script:

  • Create a symlink to it in services initialization directory (/etc/init.d or /etc/rc.d/init.d), or

  • Run update-rc.d iotellect_service defaults command (for Ubuntu and similar Linux editions), or

  • Run chkconfig --add iotellect_serviceandchkconfig iotellect_service on commands (for RedHat and LSB-compatible Linux editions)

Was this page helpful?