This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
linux:linux_systemd [2022/06/22 13:02] manu [Manage service with System V (5)] |
linux:linux_systemd [2024/06/26 15:49] (current) manu |
||
|---|---|---|---|
| Line 23: | Line 23: | ||
| ## List all services | ## List all services | ||
| <cli prompt='$'> | <cli prompt='$'> | ||
| - | $ systemctl list-units --type=service | + | $ systemctl list-units --type=service |
| + | $ systemctl list-units --type mount | ||
| </cli> | </cli> | ||
| Line 100: | Line 101: | ||
| ● ├─irqbalance.service | ● ├─irqbalance.service | ||
| </cli> | </cli> | ||
| + | |||
| ==== To enable NetworkManager, use: ==== | ==== To enable NetworkManager, use: ==== | ||
| === First, stop the running service: === | === First, stop the running service: === | ||
| - | systemctl is-active network.service && \ | + | <cli prompt='$'> |
| - | systemctl stop network.service | + | $ systemctl is-active network.service && systemctl stop network.service |
| + | </cli> | ||
| === Enable the NetworkManager service: === | === Enable the NetworkManager service: === | ||
| Line 118: | Line 121: | ||
| Check whether a service is already enabled or not: | Check whether a service is already enabled or not: | ||
| - | # systemctl is-enabled foo.service; echo $? | + | <cli prompt='$'> |
| + | $ systemctl is-enabled foo.service; echo $? | ||
| + | </cli> | ||
| 0 indicates that it is enabled. 1 indicates that it is disabled | 0 indicates that it is enabled. 1 indicates that it is disabled | ||
| === Start the NetworkManager service (via alias link): === | === Start the NetworkManager service (via alias link): === | ||
| - | systemctl start network.service | + | <cli prompt='$'> |
| + | $ systemctl start network.service | ||
| + | </cli> | ||
| ==== To disable NetworkManager, use: ==== | ==== To disable NetworkManager, use: ==== | ||
| Stop the running service: | Stop the running service: | ||
| - | systemctl is-active network.service && \ | + | <cli prompt='$'> |
| - | systemctl stop network.service | + | $ systemctl is-active network.service && \ |
| + | systemctl stop network.service | ||
| + | </cli> | ||
| Disable the NetworkManager service: | Disable the NetworkManager service: | ||
| - | systemctl disable NetworkManager.service | + | <cli prompt='$'> |
| + | $ systemctl disable NetworkManager.service | ||
| + | </cli> | ||
| Start the /etc/init.d/network service: | Start the /etc/init.d/network service: | ||
| - | systemctl start network.service | + | <cli prompt='$'> |
| + | $ systemctl start network.service | ||
| + | </cli> | ||
| all active and failed services: | all active and failed services: | ||
| - | systemctl list-units --type service --state running,failed | + | <cli prompt='$'> |
| - | | + | $ systemctl list-units --type service --state running,failed |
| + | </cli> | ||
| ==== To query the currently selected service, use: ==== | ==== To query the currently selected service, use: ==== | ||
| - | <code> | + | <cli prompt='#'> |
| graphite:~ # systemctl status network.service | graphite:~ # systemctl status network.service | ||
| NetworkManager.service - Network Manager | NetworkManager.service - Network Manager | ||
| Line 151: | Line 164: | ||
| Active: inactive (dead) | Active: inactive (dead) | ||
| CGroup: name=systemd:/system/NetworkManager.service | CGroup: name=systemd:/system/NetworkManager.service | ||
| - | </code> | + | </cli> |
| ==== Start / Stop a service ==== | ==== Start / Stop a service ==== | ||
| - | | + | |
| - | sytemctl stop network.service | + | <cli prompt='#'> |
| - | sytemctl start network.service | + | # sytemctl stop network.service |
| - | sytemctl status network.service | + | # sytemctl start network.service |
| + | # sytemctl status network.service | ||
| + | </cli> | ||
| | | ||
| ==== Create a new service ==== | ==== Create a new service ==== | ||
| Line 372: | Line 387: | ||
| </cli> | </cli> | ||
| + | Journal config file (2 ways to list it) | ||
| + | <cli prompt='#'> | ||
| + | [root@lnx01 system]# cat /etc/systemd/journald.conf | ||
| + | [root@lnx01 system]# systemd-analyze cat-config systemd/journald.conf | ||
| + | [Journal] | ||
| + | Storage=persistent | ||
| + | Compress=yes | ||
| + | #Seal=yes | ||
| + | #SplitMode=uid | ||
| + | #SyncIntervalSec=5m | ||
| + | #RateLimitIntervalSec=30s | ||
| + | #RateLimitBurst=10000 | ||
| + | #SystemMaxUse= | ||
| + | #SystemKeepFree= | ||
| + | #SystemMaxFileSize= | ||
| + | #SystemMaxFiles=100 | ||
| + | #RuntimeMaxUse= | ||
| + | #RuntimeKeepFree= | ||
| + | #RuntimeMaxFileSize= | ||
| + | #RuntimeMaxFiles=100 | ||
| + | #MaxRetentionSec= | ||
| + | MaxFileSec=1month | ||
| + | </cli> | ||
| ====== Manage service with System V (5) ====== | ====== Manage service with System V (5) ====== | ||