(새 문서: 서비스(데몬)제어 명령어는 OS(ubuntu)의 기본 명령어인 <code>systemctl</code>과 유사합니다. 일반 CLI에서에서 실행 가능합니다. OS(ubuntu)의 기본...) |
|||
(37 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | __FORCETOC__ | |
+ | === Services === | ||
+ | You can see the status of all services for the imRAD system by the <code>show service</code> command. | ||
<pre> | <pre> | ||
− | LYSH@MyHostName# | + | LYSH@MyHostName# show service |
− | + | name status version enablement 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 linked 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 shows 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 name='systemctl_man'>https://man7.org/linux/man-pages/man1/systemctl.1.html</ref> | ||
+ | |||
+ | The "enablement" is the enablement state<ref name='systemctl_man' /> of service and is either "linked" or "enabled". The "enabled" indicates that the unit is starting at boot. The "linked" is the manual start. The "disabled" means that the service is disabled. | ||
+ | {| class="wikitable" | ||
+ | ! enablement !! Auto-start !! Manual-Start | ||
+ | |- | ||
+ | | Enabled || Yes|| Yes | ||
+ | |- | ||
+ | | Linked || No|| Yes | ||
+ | |- | ||
+ | | Disabled || No|| No | ||
+ | |} | ||
+ | |||
+ | If the "runtime-log" is enabled, the specific service generates logs in real-time during the runtime of a service. For more, please refer to the below "Runtime Log" section. | ||
+ | |||
+ | The "uptime" indicates how long the service has been running or when the service is terminated abnormally(i.e. status is "failed"). | ||
+ | |||
+ | 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. | ||
+ | <pre> | ||
+ | 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 | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | If you enter the <code>show service status</code> command without a service name, it shows runtime status information about all running services. | ||
+ | LYSH@MyHostName# show service status | ||
+ | ● MyHostName | ||
+ | State: degraded | ||
+ | Jobs: 0 queued | ||
+ | Failed: 1 units | ||
+ | Since: Mon 2021-02-01 08:07:01 KST; 2 months 24 days ago | ||
+ | CGroup: / | ||
+ | ├─1282556 bpfilter_umh | ||
+ | ├─user.slice | ||
+ | │ └─user-1000.slice | ||
+ | │ ├─user@1000.service … | ||
+ | │ │ └─init.scope | ||
+ | │ │ ├─3743524 /lib/systemd/systemd --user | ||
+ | │ │ └─3743526 (sd-pam) | ||
+ | ├─init.scope | ||
+ | │ └─1 /sbin/init | ||
+ | └─system.slice | ||
+ | ├─irqbalance.service | ||
+ | │ └─777 /usr/sbin/irqbalance --foreground | ||
+ | ├─dhcpv4.service | ||
+ | │ └─3865233 /usr/sbin/ly_dhcpv4 --daemon --ipv4 | ||
+ | ├─apache2.service | ||
+ | ..................... | ||
+ | |||
+ | === Control the Service === | ||
+ | ===== Start, Stop, and Restart ===== | ||
+ | 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. | ||
+ | The following services are the names controllable. | ||
+ | * smgr | ||
+ | * dhcpv4 | ||
+ | * dhcpv6 | ||
+ | * failover | ||
+ | * startup | ||
+ | * logexp | ||
+ | * radiusd | ||
+ | * mysql | ||
+ | * apache2 | ||
+ | * rsyslog | ||
+ | |||
+ | <pre> | ||
+ | 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 | ||
+ | </pre> | ||
− | + | ===== Enable, Disable, and Link ===== | |
− | + | You can enable, disable, or link services with the <code>systemctl</code> command. | |
+ | If you link a specific service, the service will not start at boot time but you can manually start it by the <code>systemctl start</code> command. | ||
+ | If you disable a specific service, the service will not only start at boot time and also can't start manually. | ||
+ | <pre> | ||
+ | LYSH@MyHostName# systemctl enable failover | ||
+ | name status version enablement runtime-log uptime | ||
+ | ..... | ||
+ | failover inactive 6.1.1939.49 enabled enabled - | ||
+ | ..... | ||
− | + | LYSH@MyHostName# systemctl link failover | |
− | - | + | LYSH@MyHostName# show service |
+ | name status version enablement runtime-log uptime | ||
+ | ..... | ||
+ | failover inactive 6.1.1939.49 linked enabled - | ||
+ | ..... | ||
+ | </pre> | ||
− | + | LYSH@MyHostName# systemctl disable failover | |
− | + | LYSH@MyHostName# show service | |
− | + | name status version enablement runtime-log uptime | |
− | + | ..... | |
− | + | failover inactive 6.1.1939.49 disabled enabled - | |
− | + | ..... | |
− | |||
− | |||
</pre> | </pre> | ||
− | === | + | |
− | + | {{note|Note that '''DO NOT link or disable the startup, smgr, mysql, and apache2''' service that are required services.}} | |
− | + | The default enablement states are | |
− | + | * linked: dhcpv4, dhcpv6, failover, logexp, and radiusd | |
− | + | * enabled: smgr, startup, mysql, and apache2 | |
− | * < | + | |
− | + | ||
− | + | === 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".<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. | ||
+ | If not synchronized, you need to restart the service. | ||
+ | |||
+ | To display the "Runtime data" of each service, enter the <code>show service {service name} {data type}</code> command. | ||
+ | <pre> | ||
+ | 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 | ||
+ | </pre> | ||
+ | |||
+ | 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> | ||
+ | |||
+ | Only the dhcpv4, dhcpv6, and failover service have the Runtime Data. | ||
+ | |||
+ | ===== [[ImRAD services(daemons) | 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 Global Configurations | service configuration setting]]. | ||
+ | |} | ||
+ | ===== [[ImRAD services(daemons) | logexp]] ===== | ||
+ | {| class="wikitable" | ||
+ | ! style='width:150px' | argument !! Description | ||
+ | |- | ||
+ | | server || It shows the result of exporting logs. | ||
+ | |- | ||
+ | | setting || It shows the [[Variables of Global Configurations(Variable) | global variables]] of logexp service. | ||
+ | |- | ||
+ | | table || It shows the result of exporting each log table. | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | === Runtime Log === | ||
+ | The Runtime Log is the logs that were generated in real-time during the runtime of a service. You can enable the Runtime log of service for the purpose of analyzing or feedback. | ||
+ | <pre> | ||
+ | LYSH@MyHostName# configure | ||
+ | LYSH@MyHostName(config)# rtlog enable {service_name} | ||
+ | LYSH@MyHostName(config)# exit | ||
+ | LYSH@MyHostName# show log {service_name} -w | ||
+ | </pre> | ||
+ | |||
+ | If you enable the Runtime Log of services, you can watch the logs by the <code>show log</code> command. For more options to show logs, please refer to the [[CLI - Log]] section | ||
+ | <pre> | ||
+ | LYSH@MyHostName# show log dhcpv4 | ||
+ | </pre> | ||
+ | |||
+ | The Runtime log configuration for both "smgr", "startup", and "radiusd" service is already enabled. Remark that you cannot disable the Runtime log for the "radiusd" service. | ||
+ | |||
+ | {{note|Note that you should disable it after doing your job because the service may generate a log of Runtime Logs.}} | ||
+ | |||
+ | === Configuring the Service Variables === | ||
+ | You can configure the [[Variables of Global Configurations | variables]] of the DHCP and [[ImRAD services(daemons) | logexp]] Service in the configuration mode. | ||
+ | If you want to see the current values, enter the <code>show system</code> or <code>show config</code> command. | ||
+ | ===== dhcpv4 / dhcpv6 ===== | ||
+ | <pre> | ||
+ | LYSH@MyHostName# configure | ||
+ | LYSH@MyHostName(config)# dhcpv4 {argument} {value} // configuring a variable of the dhcpv4 service | ||
+ | LYSH@MyHostName(config)# dhcpv6 {argument} {value} // configuring a variable of the dhcpv4 service | ||
+ | </pre> | ||
+ | {| class="wikitable" | ||
+ | ! style='width:150px' | argument !! variable name | ||
+ | |- | ||
+ | | dbpool || dhcpv4_dbpool, dhcpv6_dbpool | ||
+ | |- | ||
+ | | decline || dhcpv4_decline_age, dhcpv6_decline_age | ||
+ | |- | ||
+ | | entid|| entid_from_hostname | ||
+ | |- | ||
+ | | expire || dhcpv4_expire_check_intv, dhcpv6_expire_check_intv | ||
+ | |- | ||
+ | | postdhcp|| postdhcp_success | ||
+ | |- | ||
+ | | rcvbuf|| dhcpv4_socket_rcvbuf, dhcpv6_socket_rcvbuf | ||
+ | |- | ||
+ | | reservip || check_reserv_ip_at_renew | ||
+ | |- | ||
+ | | sndbuf|| dhcpv4_socket_sndbuf, dhcpv6_socket_sndbuf | ||
+ | |- | ||
+ | | encoding || from_encoding | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ===== logexp ===== | ||
+ | <pre> | ||
+ | LYSH@MyHostName# configure | ||
+ | LYSH@MyHostName(config)# logexp {argument} {value} // configuring a variable of the logexp service | ||
+ | </pre> | ||
+ | {| class="wikitable" | ||
+ | ! style='width:150px' | argument !! variable name | ||
+ | |- | ||
+ | | dbpool || logexp_dbpool | ||
+ | |- | ||
+ | | lsyslog || lsyslog_priority | ||
+ | |- | ||
+ | | syslog || syslog_priority | ||
+ | |} | ||
+ | {{note|Note that you should read what the [[Variables of Global Configurations | variable]] means before configuring a variable}} | ||
+ | |||
+ | === References === |
Latest revision as of 10:53, 28 January 2022
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 enablement 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 linked 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 shows 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 "enablement" is the enablement state[1] of service and is either "linked" or "enabled". The "enabled" indicates that the unit is starting at boot. The "linked" is the manual start. The "disabled" means that the service is disabled.
enablement | Auto-start | Manual-Start |
---|---|---|
Enabled | Yes | Yes |
Linked | No | Yes |
Disabled | No | No |
If the "runtime-log" is enabled, the specific service generates logs in real-time during the runtime of a service. For more, please refer to the below "Runtime Log" section.
The "uptime" indicates how long the service has been running or when the service is terminated abnormally(i.e. status is "failed").
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 all running services.
LYSH@MyHostName# show service status ● MyHostName State: degraded Jobs: 0 queued Failed: 1 units Since: Mon 2021-02-01 08:07:01 KST; 2 months 24 days ago CGroup: / ├─1282556 bpfilter_umh ├─user.slice │ └─user-1000.slice │ ├─user@1000.service … │ │ └─init.scope │ │ ├─3743524 /lib/systemd/systemd --user │ │ └─3743526 (sd-pam) ├─init.scope │ └─1 /sbin/init └─system.slice ├─irqbalance.service │ └─777 /usr/sbin/irqbalance --foreground ├─dhcpv4.service │ └─3865233 /usr/sbin/ly_dhcpv4 --daemon --ipv4 ├─apache2.service .....................
Control the Service
Start, Stop, and Restart
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
Enable, Disable, and Link
You can enable, disable, or link services with the systemctl
command.
If you link a specific service, the service will not start at boot time but you can manually start it by the systemctl start
command.
If you disable a specific service, the service will not only start at boot time and also can't start manually.
LYSH@MyHostName# systemctl enable failover name status version enablement runtime-log uptime ..... failover inactive 6.1.1939.49 enabled enabled - ..... LYSH@MyHostName# systemctl link failover LYSH@MyHostName# show service name status version enablement runtime-log uptime ..... failover inactive 6.1.1939.49 linked enabled - .....
LYSH@MyHostName# systemctl disable failover LYSH@MyHostName# show service name status version enablement runtime-log uptime ..... failover inactive 6.1.1939.49 disabled enabled - .....
Note that DO NOT link or disable the startup, smgr, mysql, and apache2 service that are required services.
The default enablement states are
- linked: dhcpv4, dhcpv6, failover, logexp, and radiusd
- enabled: smgr, startup, mysql, and apache2
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.
If not synchronized, you need to restart the service.
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
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...
Only the dhcpv4, dhcpv6, and failover service have the Runtime Data.
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.
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.
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. |
logexp
argument | Description |
---|---|
server | It shows the result of exporting logs. |
setting | It shows the global variables of logexp service. |
table | It shows the result of exporting each log table. |
Runtime Log
The Runtime Log is the logs that were generated in real-time during the runtime of a service. You can enable the Runtime log of service for the purpose of analyzing or feedback.
LYSH@MyHostName# configure LYSH@MyHostName(config)# rtlog enable {service_name} LYSH@MyHostName(config)# exit LYSH@MyHostName# show log {service_name} -w
If you enable the Runtime Log of services, you can watch the logs by the show log
command. For more options to show logs, please refer to the CLI - Log section
LYSH@MyHostName# show log dhcpv4
The Runtime log configuration for both "smgr", "startup", and "radiusd" service is already enabled. Remark that you cannot disable the Runtime log for the "radiusd" service.
Note that you should disable it after doing your job because the service may generate a log of Runtime Logs.
Configuring the Service Variables
You can configure the variables of the DHCP and logexp Service in the configuration mode.
If you want to see the current values, enter the show system
or show config
command.
dhcpv4 / dhcpv6
LYSH@MyHostName# configure LYSH@MyHostName(config)# dhcpv4 {argument} {value} // configuring a variable of the dhcpv4 service LYSH@MyHostName(config)# dhcpv6 {argument} {value} // configuring a variable of the dhcpv4 service
argument | variable name |
---|---|
dbpool | dhcpv4_dbpool, dhcpv6_dbpool |
decline | dhcpv4_decline_age, dhcpv6_decline_age |
entid | entid_from_hostname |
expire | dhcpv4_expire_check_intv, dhcpv6_expire_check_intv |
postdhcp | postdhcp_success |
rcvbuf | dhcpv4_socket_rcvbuf, dhcpv6_socket_rcvbuf |
reservip | check_reserv_ip_at_renew |
sndbuf | dhcpv4_socket_sndbuf, dhcpv6_socket_sndbuf |
encoding | from_encoding |
logexp
LYSH@MyHostName# configure LYSH@MyHostName(config)# logexp {argument} {value} // configuring a variable of the logexp service
argument | variable name |
---|---|
dbpool | logexp_dbpool |
lsyslog | lsyslog_priority |
syslog | syslog_priority |
Note that you should read what the variable means before configuring a variable