System and Service Management
SmartServer 3.6 and prior uses supervisorctl to manage custom applications that run as a service. See Installing the Data Monitoring Application on Your SmartServer IoT to set up a custom application as a service.
SmartServer 4.0 and higher uses smartserverctl, a wrapper for systemd, to manage components running as a service. See Managing Services with smartserverctl for more information.
When updating from SmartServer 3.6 to 4.0 and higher, it is necessary to migrate from supervisorctl to smartserverctl for custom device types and services. This section describes how to migrate from supervisorctl to smartserverctl and consists of the following:
Overview
Migrating from supervisorctl to smartserverctl for custom device types and services requires the following steps:
Creating unit files for each service to be migrated
Placing files in the /lib/systemd/system/smartserver-<service>.service directory
Installing services
Starting services
These steps are described in the sections that follow. Once the migration process is completed, all of your services will be running using systemd.
Creating Unit Files
Prerequisite: SmartServer 4.0 or higher has been installed on your system.
Unit files are plain text files that contain configuration information about a service. They are used by systemd to control how and when a service is started and stopped.
You need to create unit files for each service that was supervised by supervisorctl and that you want to migrate to smartserverctl.
The example below is a unit file for a service called myService:
[Unit] [Service] [Install] |
---|
Create unit files for each service and place the files in the directory: /usr/lib/systemd/system/.
The format for each service unit file name is smartserver-<service>.service, where <service> is the name you want to use to refer to your service. The name is case-sensitive and should reflect the purpose of the service. For the example above, the file name would be smartserver-myService.service.
Installing Services
Once unit files have been created for all of your services, you can install them by entering the following command:
For <service>, use the name of your service as defined in the unit file.
$ sudo smartserverctl enable smartserver-<service>.service
This command installs the services; they will automatically start up when the system boots.
Starting Services
Once all of your services have been installed, you can start them by using the smartserverctl commands. For example, enter following command to start a service:
$ sudo smartserverctl start <service>
You can also use the smartserverctl command to check the status of your services. For example, enter the following command to check the status of a service:
$ sudo smartserverctl status <service>