Difference between revisions of "CLI - Services(daemons)"

Line 1: Line 1:
 +
__FORCETOC__
 
=== Services ===
 
=== Services ===
You can see all services for the imRAD system by the <code>show service</code> command.
+
You can see the status of all services for the imRAD system by the <code>show service</code> command.
 
<pre>
 
<pre>
LYSH@MyHostName# show service -h
+
LYSH@MyHostName# show service
usage: show service [-h] {all,dhcpv4,dhcpv6,logexp,status} ...
+
name            status      version        enable      runtime-log  uptime
 +
dhcpv4          active      6.1.2059.137    linked      enabled      since Thu 2021-04-08 16:11:35 KST; 1 weeks 4 days ago
 +
dhcpv6          active      6.1.2059.137    linked      enabled      since Mon 2021-04-05 14:55:22 KST; 2 weeks 1 days ago
 +
failover        inactive    6.1.1939.49    disabled    enabled      -
 +
logexp          active      1.1.2043.208    linked      enabled      since Mon 2021-03-29 09:21:54 KST; 3 weeks 1 days ago
 +
radiusd        active      3.0.21.1751    linked      enabled      since Tue 2021-04-13 14:53:06 KST; 1 weeks 0 days ago
 +
smgr            active      6.0.2060.1      linked      enabled      since Tue 2021-03-23 16:01:00 KST; 3 weeks 6 days ago
 +
startup        active      1.1.1955.1      enabled    enabled      since Mon 2021-02-01 08:07:05 KST; 2 months 17 days ago
 +
</pre>
 +
The status show the unit state, one of active, reloading, inactive, failed, activating, deactivating. The "active" indicates that the unit is running and the "Inactive" indicates that the unit is stopped normally.
 +
If the status is "failed", it indicates that the unit is terminated abnormally. <ref>https://man7.org/linux/man-pages/man1/systemctl.1.html</ref>
 +
 
 +
The "enable" is either "linked", "disabled", or "enabled". The "enabled" indicates that the unit is starting at boot. The "linked" is manual start and the "disabled" means the unit is not using.
  
positional arguments:
+
If you want to see the status of a service, enter the <code>systemctl status {name}</code> or <code>show service status {name}</code> command.
    all                              Show List all services
+
<pre>
    dhcpv4                          dhcpv4 ...
+
LYSH@MyHostName# systemctl status smgr
    dhcpv6                          dhcpv6 ...
+
● smgr.service - System Management service
    logexp                          logexp ...
+
    Loaded: loaded (/lib/systemd/system/smgr.service; linked; vendor preset: enabled)
    status                          Show the status of a service
+
    Active: active (running) since Tue 2021-03-23 16:01:00 KST; 3 weeks 6 days ago
 +
  Main PID: 203770 (ly_smgr)
 +
      Tasks: 1 (limit: 9387)
 +
    Memory: 28.9M
 +
    CGroup: /system.slice/smgr.service
 +
            └─203770 /usr/bin/php7.2 /usr/sbin/ly_smgr sys
  
optional arguments:
 
  -h, --help                        show this help message and exit
 
 
</pre>
 
</pre>
  
 +
If you enter the <code>show service status</code> command without a service name, it shows runtime status information about services.
  
=== Controling a service ===
+
 
 +
=== Control the Service ===
 
You can start, stop, and restart a service(daemon) using the <code>systemctl</code> command.
 
You can start, stop, and restart a service(daemon) using the <code>systemctl</code> command.
 
You can't control all services in the operating system but only the [[imRAD services(daemons) | imRAD services]] and some services.
 
You can't control all services in the operating system but only the [[imRAD services(daemons) | imRAD services]] and some services.
Line 33: Line 51:
  
 
<pre>
 
<pre>
LYSH@MyHostName# systemctl -h
+
LYSH@MyHostName# systemctl start smgr // Starting the smgr service.
usage: systemctl [-h] {disable,enable,reload,restart,start,status,stop} ... service
+
LYSH@MyHostName# show service // display all services
  
The 'systemctl' command
+
LYSH@MyHostName# systemctl stop smgr // Stopping the smgr service.
 +
LYSH@MyHostName# show service // display all services
 +
 
 +
LYSH@MyHostName# systemctl restart smgr // Restarting the smgr service.
 +
LYSH@MyHostName# show service // display all services
 +
</pre>
  
positional arguments:
 
  service              service name( start only this one ) or all
 
  
optional arguments:
+
=== Runtime Data ===
  -h, --help            show this help message and exit
+
Some services are loading data from the database or configuration files before running. Changed configurations or database records are applied in a few seconds to each service. We call it "Runtime Data".<br>
 +
The "Runtime Data" must same as the data shown in the management interface. For example, If you add a DHCP pool from the management interface, the same pool must be shown in the "Runtime Data".
 +
In other words, It indicates that data between management interfaces and services were synchronized.
  
Commands arguments:
+
To display the "Runtime data" of each service, enter the <code>show service {service name} {data type}</code> command.
    disable            disable service
+
<pre>
    enable              enable service
+
LYSH@MyHostName# show service dhcpv4 pool
    reload              reload service
+
DHCP-Scope> written at 2021-04-20 16:10:09 (KST, +0900)
     restart            restart service
+
--------------------------------------------------------------------------------------------------------
     start               start service
+
ssid    ipver  stateful        ptn        T(preferred)    T(valid)
     status              status service
+
sid     ena     gateway                                    start ip                  count    IA
    stop                stop service
+
--------------------------------------------------------------------------------------------------------
 +
119     4      -              0          10m            6h
 +
#250    y      192.168.5.1/24                              192.168.5.200            20        0x01
 
</pre>
 
</pre>
  
Note that some services do not support the reload command.
+
Note than if the service is not running, the <code>show service {service name} {data type}</code> command will show error.
 +
<pre>
 +
LYSH@MyHostName# show service dhcpv4 pool
 +
sending request> message[0], ipver[4]
 +
[E-11] No response from service...
 +
</pre>
 +
 
 +
==== DHCPv4/DHCPv6 ====
 +
{| class="wikitable"
 +
! style='width:150px' | argument !! Description
 +
|-
 +
| failover || Displays the status of DHCP Failover.
 +
|-
 +
| host || Displays all IP addresses in all DHCP Pools. You can get only filtered results by specifying keywords.
 +
* status:
 +
** avail: Available IP address that can be assigned to another host.
 +
** decl: Declined IP address that is not assigned to another host during the "dhcpv4_decline_age" or "dhcpv6_decline_age".
 +
** bound: The IP address is in use.
 +
** offer: It is shown as "advert"(i.e. advertisement) in the DHCPv6, the IP address was offered to a host but not completed the DHCP operation.
 +
** invalid: The IP address is out of the DHCP pool.
 +
* flag: If the IP address is reserved for a host, the flag has 0x2. If the IP is excluded, it has 0x4. For example, If the flag is 0x6, the IP address is both in reserve and exclude. If a flag has 0x1, it means that the IP address is out of the pool.
 +
* age: It is the time that was elapsed from the latest allocation. If the status is "bound", the age is increased. if a host sends a renew to expand its lease time, the age is set to 0.
 +
If the age is greater than or equal to the [[DHCP Pool configuration | Lease Time]] of its DHCP Pool, the status of the IP address is changed to "avail". In other words, the Lease of the IP address expires.
 +
* oage: If an IP address was offered to a host and the status of the IP address remains as "offer" or "advert" for 30 seconds, the status of the IP address is changed to "avail". In other words, If a host does not complete the DHCP operation, the offered IP address to the host can be assigned to another.
 +
* hit-date: It is the latest response Datetime to a host.
 +
 
 +
You can also find some terms in the [[IP Address list]] section.
 +
|-
 +
| option || It show all [[DHCP Option configuration | DHCP options]].
 +
|-
 +
| reserv || It show all reserved IP address. You can get only filtered results by specifying keywords.
 +
|-
 +
| setting || It shows information that was loaded from the [[Variables of Service Configuration settings | service configuration setting]].
 +
|}
  
<pre>
+
=== Runtime Log ===
LYSH@MyHostName# systemctl start smgr // Starting the smgr service.
 
LYSH@MyHostName# show service // display all services
 
  
LYSH@MyHostName# systemctl stop smgr // Stopping the smgr service.
+
=== Configuring the Service Setting ===
LYSH@MyHostName# show service // display all services
 
  
LYSH@MyHostName# systemctl restart smgr // Restarting the smgr service.
+
=== References ===
LYSH@MyHostName# show service // display all services
 
</pre>
 

Revision as of 17:15, 20 April 2021

Services

You can see the status of all services for the imRAD system by the show service command.

LYSH@MyHostName# show service
name            status      version         enable      runtime-log   uptime
dhcpv4          active      6.1.2059.137    linked      enabled       since Thu 2021-04-08 16:11:35 KST; 1 weeks 4 days ago
dhcpv6          active      6.1.2059.137    linked      enabled       since Mon 2021-04-05 14:55:22 KST; 2 weeks 1 days ago
failover        inactive    6.1.1939.49     disabled    enabled       -
logexp          active      1.1.2043.208    linked      enabled       since Mon 2021-03-29 09:21:54 KST; 3 weeks 1 days ago
radiusd         active      3.0.21.1751     linked      enabled       since Tue 2021-04-13 14:53:06 KST; 1 weeks 0 days ago
smgr            active      6.0.2060.1      linked      enabled       since Tue 2021-03-23 16:01:00 KST; 3 weeks 6 days ago
startup         active      1.1.1955.1      enabled     enabled       since Mon 2021-02-01 08:07:05 KST; 2 months 17 days ago

The status show the unit state, one of active, reloading, inactive, failed, activating, deactivating. The "active" indicates that the unit is running and the "Inactive" indicates that the unit is stopped normally. If the status is "failed", it indicates that the unit is terminated abnormally. [1]

The "enable" is either "linked", "disabled", or "enabled". The "enabled" indicates that the unit is starting at boot. The "linked" is manual start and the "disabled" means the unit is not using.

If you want to see the status of a service, enter the systemctl status {name} or show service status {name} command.

LYSH@MyHostName# systemctl status smgr
● smgr.service - System Management service
     Loaded: loaded (/lib/systemd/system/smgr.service; linked; vendor preset: enabled)
     Active: active (running) since Tue 2021-03-23 16:01:00 KST; 3 weeks 6 days ago
   Main PID: 203770 (ly_smgr)
      Tasks: 1 (limit: 9387)
     Memory: 28.9M
     CGroup: /system.slice/smgr.service
             └─203770 /usr/bin/php7.2 /usr/sbin/ly_smgr sys

If you enter the show service status command without a service name, it shows runtime status information about services.


Control the Service

You can start, stop, and restart a service(daemon) using the systemctl command. You can't control all services in the operating system but only the imRAD services and some services. The following services are the names controllable.

  • smgr
  • dhcpv4
  • dhcpv6
  • failover
  • startup
  • logexp
  • radiusd
  • mysql
  • apache2
  • rsyslog
LYSH@MyHostName# systemctl start smgr		// Starting the smgr service.
LYSH@MyHostName# show service			// display all services

LYSH@MyHostName# systemctl stop smgr		// Stopping the smgr service.
LYSH@MyHostName# show service			// display all services

LYSH@MyHostName# systemctl restart smgr		// Restarting the smgr service.
LYSH@MyHostName# show service			// display all services


Runtime Data

Some services are loading data from the database or configuration files before running. Changed configurations or database records are applied in a few seconds to each service. We call it "Runtime Data".
The "Runtime Data" must same as the data shown in the management interface. For example, If you add a DHCP pool from the management interface, the same pool must be shown in the "Runtime Data". In other words, It indicates that data between management interfaces and services were synchronized.

To display the "Runtime data" of each service, enter the show service {service name} {data type} command.

LYSH@MyHostName# show service dhcpv4 pool
DHCP-Scope> written at 2021-04-20 16:10:09 (KST, +0900)
--------------------------------------------------------------------------------------------------------
ssid    ipver   stateful        ptn         T(preferred)    T(valid)
sid     ena     gateway                                     start ip                  count     IA
--------------------------------------------------------------------------------------------------------
119     4       -               0           10m             6h
#250    y       192.168.5.1/24                              192.168.5.200             20        0x01

Note than if the service is not running, the show service {service name} {data type} command will show error.

LYSH@MyHostName# show service dhcpv4 pool
sending request> message[0], ipver[4]
[E-11] No response from service...

DHCPv4/DHCPv6

argument Description
failover Displays the status of DHCP Failover.
host Displays all IP addresses in all DHCP Pools. You can get only filtered results by specifying keywords.
  • status:
    • avail: Available IP address that can be assigned to another host.
    • decl: Declined IP address that is not assigned to another host during the "dhcpv4_decline_age" or "dhcpv6_decline_age".
    • bound: The IP address is in use.
    • offer: It is shown as "advert"(i.e. advertisement) in the DHCPv6, the IP address was offered to a host but not completed the DHCP operation.
    • invalid: The IP address is out of the DHCP pool.
  • flag: If the IP address is reserved for a host, the flag has 0x2. If the IP is excluded, it has 0x4. For example, If the flag is 0x6, the IP address is both in reserve and exclude. If a flag has 0x1, it means that the IP address is out of the pool.
  • age: It is the time that was elapsed from the latest allocation. If the status is "bound", the age is increased. if a host sends a renew to expand its lease time, the age is set to 0.

If the age is greater than or equal to the Lease Time of its DHCP Pool, the status of the IP address is changed to "avail". In other words, the Lease of the IP address expires.

  • oage: If an IP address was offered to a host and the status of the IP address remains as "offer" or "advert" for 30 seconds, the status of the IP address is changed to "avail". In other words, If a host does not complete the DHCP operation, the offered IP address to the host can be assigned to another.
  • hit-date: It is the latest response Datetime to a host.

You can also find some terms in the IP Address list section.

option It show all DHCP options.
reserv It show all reserved IP address. You can get only filtered results by specifying keywords.
setting It shows information that was loaded from the service configuration setting.

Runtime Log

Configuring the Service Setting

References