This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
управление_сервисами_в_linux [2024/12/28 08:36] val [Управление юнитами Systemd] |
управление_сервисами_в_linux [2025/08/09 17:11] (current) val |
||
---|---|---|---|
Line 132: | Line 132: | ||
# chkconfig --list sshvpn | # chkconfig --list sshvpn | ||
- | # chkconfig --del sshvpn | + | # chkconfig sshvpn on |
+ | |||
+ | # #chkconfig sshvpn off | ||
+ | |||
+ | # #chkconfig --del sshvpn | ||
</code> | </code> | ||
==== Управление ресурсами ==== | ==== Управление ресурсами ==== | ||
Line 149: | Line 153: | ||
* [[https://wiki.archlinux.org/index.php/systemd|systemd]] | * [[https://wiki.archlinux.org/index.php/systemd|systemd]] | ||
- | ==== Управление юнитами Systemd ===== | + | ==== Управление юнитами Systemd ==== |
* [[https://docs.gitea.io/en-us/linux-service/|Run Gitea as Linux service]] | * [[https://docs.gitea.io/en-us/linux-service/|Run Gitea as Linux service]] | ||
Line 157: | Line 161: | ||
$ systemctl -a | $ systemctl -a | ||
$ systemctl list-units | $ systemctl list-units | ||
+ | $ systemctl --failed | ||
+ | $ systemctl reset-failed | ||
centos# find /usr/lib/systemd/system/ | centos# find /usr/lib/systemd/system/ | ||
Line 177: | Line 183: | ||
Description=ssh client vpn daemon | Description=ssh client vpn daemon | ||
After=network.target | After=network.target | ||
+ | #StartLimitIntervalSec=60 | ||
+ | #StartLimitBurst=3 | ||
[Service] | [Service] | ||
- | ExecStart=/usr/bin/ssh -N -R 61000+X:localhost:22 -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes userX@gate.isp.un | + | ExecStart=/usr/bin/ssh -N -R 61000+X:localhost:22 -o ServerAliveInterval=5 -o ServerAliveCountMax=1 -o ExitOnForwardFailure=yes userX@gate.isp.un |
- | #ExecStart=/usr/bin/java -jar /home/jenkins/agent.jar -url http://server.corp13.un:8081/ -secret NNNNNNNNNNNNNNNNNNNN -name gate -workDir "/home/jenkins/" | + | ###ExecStart=/usr/bin/java -jar /home/jenkins/agent.jar -url http://server.corp13.un:8081/ -secret NNNNNNNNNNNNNNNNNNNN -name gate -workDir "/home/jenkins/" |
- | #User=jenkins | + | ###User=jenkins |
KillMode=process | KillMode=process | ||
Restart=always | Restart=always | ||
- | RestartSec=42s | + | RestartSec=5s |
[Install] | [Install] | ||
Line 196: | Line 204: | ||
</code> | </code> | ||
- | ==== Настройка параметров запуска в Systemd ===== | + | ==== Настройка параметров запуска в Systemd ==== |
<code> | <code> | ||
Line 202: | Line 210: | ||
</code><code> | </code><code> | ||
[Service] | [Service] | ||
- | LimitNOFILE=65536 # nginx | + | LimitNOFILE=65536 # nginx, squid |
TimeoutStartSec=180 # elasticsearch | TimeoutStartSec=180 # elasticsearch | ||
</code><code> | </code><code> | ||
Line 215: | Line 223: | ||
# cat /proc/NNNNN/limits | # cat /proc/NNNNN/limits | ||
</code> | </code> | ||
+ | |||
+ | ==== Systemd Sockets ==== | ||
+ | |||
+ | * [[https://gist.github.com/drmalex07/28de61c95b8ba7e5017c|README-setup-socket-activated-systemd-service.md]] | ||
+ | |||
+ | <code> | ||
+ | # cat /etc/systemd/system/webd.socket | ||
+ | </code><code> | ||
+ | [Unit] | ||
+ | Description=Web Socket | ||
+ | |||
+ | [Socket] | ||
+ | ListenStream=127.0.0.1:9999 | ||
+ | Accept=yes | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=sockets.target | ||
+ | </code><code> | ||
+ | # cat /etc/systemd/system/webd@.service | ||
+ | </code><code> | ||
+ | [Unit] | ||
+ | Description=WebD Service | ||
+ | Requires=webd.socket | ||
+ | |||
+ | [Service] | ||
+ | Type=simple | ||
+ | ExecStart=/usr/local/sbin/webd %i | ||
+ | StandardInput=socket | ||
+ | StandardError=journal | ||
+ | TimeoutStopSec=5 | ||
+ | #RuntimeMaxSec=10 | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </code><code> | ||
+ | # systemctl start webd.socket | ||
+ | |||
+ | # curl 127.0.0.1:9999 | ||
+ | |||
+ | # journalctl -u 'webd@*' -n 20 --no-pager | ||
+ | </code> | ||
+ | |||
===== Система загрузки OpenRC ===== | ===== Система загрузки OpenRC ===== | ||